var vm = new Vue({
    el: '#app',
    // mixins: [mixin_common],
    data: {
        alarmName:'',//区域名称
        showSetAlarmOpacity:false,//是否显示区域设置界面
        alermValue:'',
        alermAreaObj:'',
        alermValueData:{
            options:[{
                label:'抑制区域',
                value:'0'
            },{
                label:'告警区域',
                value:'1'
            }]
        },
        userGeoLayer1:null,
        userGeoLayer2:null,
        userGeoLayer3:null,
        isIntelligenceSources:null,
        ISgeoJsonLayer:null,
        userGeoLayer:null,
        
        setPositionKey:null,//比例尺
        setTimeKey:null, //地图飞机定时器存储变量值
        setTishi:0,
        MainMap:null,
        selectFlyType:0,
        zoomIndex:8,//地图缩放比例值
        isQBFF:false,//新增情报分发显示隐藏值
        IntelligenceDistribution:{},//情报分发
        Intelligenceform: [
            {
                label: '危险气象',
                value: '1'
            },
            {
                label: '空域管制',
                value: '2'
            },
            {
                label: '临时通知',
                value: '3'
            }
        ],
        userInfo:{
            userId:'b49badcc-6e51-4228-b8e8-a6a03ace226f',
            userRightInfo:{
                userName:'heda'
            },
            // pointsDecimal:'[29.618493015610223, 106.6510945558548]',重庆
            // pointsDecimal:'[30.377777777777776,120.04916666666666]',德清
            pointsDecimal :'[31.22314,121.48132]',//上海
            geojson:{
                "type": "FeatureCollection",
                "features": [
                    {
                        "type": "Feature",
                        "properties": null,
                        "geometrys": null,
                        "geometrysNew": {
                            "type": "Polygon",
                            "coordinates": [
                                [
                                    [
                                        105.85839,
                                        30.38474
                                    ],
                                    [
                                        105.3476,
                                        28.55487
                                    ],
                                    [
                                        105.84191,
                                        28.91735
                                    ],
                                    [
                                        106.36368,
                                        28.52714
                                    ],
                                    [
                                        106.86348,
                                        28.714
                                    ],
                                    [
                                        107.97293,
                                        28.96681
                                    ],
                                    [
                                        109.14542,
                                        28.25473
                                    ],
                                    [
                                        108.78861,
                                        29.46244
                                    ],
                                    [
                                        108.54695,
                                        30.7155
                                    ]
                                ]
                            ]
                        }
                    }
                ]
            },
        },
        mapLayer:[],//地图路径
        isSetMap:false,//地图按钮显示隐藏
        showQT : false,//其它信息展示隐藏
        isClass: false,//上啦下拉图片切换
        isList: false,
        islistClass : false,
        listValue : "报告记录",
        //  	by fuxin 9-27
        curRowjkmbFirst: {}, //监控目标一级列表当前点击行数据
        cursignalSource: '',
        curtargetAddress:"",
        searchAdress:'',	//搜索得值
        searchAttAdress:'',
        jkmbSecondlist: { //监控目标二级弹窗分页
            curPage: 1,
            totalPage: 0,
            totalNum:0
        },
        SignalNum: 0, //信号源总数量
        clock_getSignallist: {}, //定时刷新信号源列表
        ProcessNum:0,//飞行进程总数量
        clock_getProcessNum: {}, //定时飞行进程列表
        AlarmNum:0,
        clock_getProcessNum:{},

        nowTime: "",//系统时间
        nowTimegang:"",//飞行进程 - 飞行详情进程 - 状态记录 - 保存    时间参数
        executorDate:"",
        activeIndex: '1',
        map: null, //地图
        rightMaps: null,//简报飞行地图
        AlarmMaps: null,
        selectedflight: null, //选中的飞机 
        centerPoint: {}, //地图中心点，用于查询数据
        flightLayers: [], //飞机图层集合
        flightLayerGroup: null, //飞机图层分组
        flightScutcheonLayers: [], //飞机图层集合
        flightScutcheonLayersGroup: null, //飞机图层分组 
        flightTrackLayers:[],//飞机尾迹
        flightTrackLayersGroup:null,//飞机尾迹图层分组
        flightGeoLayer:null,//飞行进程区域
        flightGeoLayers:[],
        flightGeoLayerGroup:null,
        flyPlansArr:[],
        predictingTrajectoryLayers:[],//预测轨迹集合
        predictingTrajectoryGroup:null,//预测轨迹分组
        historyTrajectoryLayers:[],//历史轨迹集合
        historyTrajectoryGroup:null,//历史轨迹分组
        historyTrajectoryLayer:"",
        historyTrajectoryLastPoint:null,
         
        ifShowScutcheon: true, //是否显示标牌
        infosOpacitys: false, //监控目标二级菜单隐藏值
        flightOpacitys: false, //飞机进程二级菜单隐藏值
        recordOpacitys: false, //飞机进程三级菜单隐藏值
        addFlightOpacitys: false,//新建飞行进程弹出框隐藏值
        FlightBriefingOpacitys: false,//飞行简报弹出框隐藏值
        isVoice:false,//告警记录列表---告警声音隐藏显示隐藏按钮
        isRescue:false,//告警记录列表---救援报告按钮显示隐藏按钮
        AlarmListOpacitys:false,//告警详情记录显示隐藏
        RescueReportOpacitys:false,//救援报告显示隐藏
        RescueReportListOpacitys:false,//协助救援报告显示隐藏
        transferOpacitys:false,    //飞行进程移交记录显示隐藏
        flyProcessTableData: [],      //飞行进程移交记录
        emergencyEvent: false,    //应急事件的显示隐藏
        emergencyOpacitys:false,//新增应急事件显示隐藏
        addEmergencyForm:{},//新增应急事件数据对象
        emergencyTableData:[], //导航应急事件

        processStateArr : ["01","02","11","12","13","14","18","19","21","22"],//飞行进程状态数值
        formInline: [
            {
                label: '未激活',
                value: '01'
            },
            {
                label: '预激活',
                value: '02'
            },
            {
                label: '离港',
                value: '11'
            },
            {
                label: '巡航',
                value: '12'
            },
            {
                label: '进近',
                value: '13'
            },
            {
                label: '着陆',
                value: '14'
            },
            {
                label: '移交',
                value: '18'
            },
            {
                label: '紧急',
                value: '19'
            },
            {
                label: '结束',
                value: '21'
            },
            {
                label: '取消',
                value: '22'
            },
        ],
        flyCodes:[],
        toolNav1: false,//气象
        toolNav2: false,//消息
        toolNav3: false,//情报
        activeName2: 'first',
        messageNum:0,//系统总消息
        messageArr:[],
        systemMessage:[],//系统消息
        equipmentMessage:[],//设备消息
        IntelligenceSources:[],//情报消息
        Radarvalue: false,//雷达实况
        Radarlyr:null,//雷达实况
        Isolinevalue:false,//等值线
        Isolinelyr:null,//等值线
        Scattervalue:false,//天气格点
        Scatterlyr:null,//天气格点
        Lightvalue:false,//闪电
        Lightlyr:null,//闪电
        FSSValue: false,
        
        enroteValue:false,//航路航线
        enroteLayer:null,
        airportValue:false,//机场
        airportLayer:null,
        ctrlairspaceValue:false,//管制空域
        ctrlairspaceLayer:null,
        restairspaceValue:false,//限制空域
        restairspaceLayer:null,
        //baolin
        emergencyResources: false,     //应急资源
        ERLayer: [],                   //应急资源图层集合
        ERLayerGroup: null,            //应急资源图层分组
        selectedADSB: null, //选中的服务站
        selectedVHF: null,  //选中的VHF电台
        adsbValue: false, //飞行服务站
        adsbLayer: [],   //adsb飞行服务站图层集合
        adsbLayerGroup: null,  //飞机图层分组
        vhfValue: false,  //通讯设施VHF
        VHFLayer: [],   //VHF通讯设施图层集合
        VHFLayerGroup: null,  //VHF通讯设施图层分组
        VHFcirLayer:[],
        VHFcirLayerGroup:null,
        VHFLayers:[],
        VHFLayersGroup:null,
        ADSBLayers:[],
        ADSBLayersGroup:null,
        alarmLayers:[],
        alarmLayersGroup:null,
        //baolin 
        showReportDocuments: true, //报告记录
        showStateRecords: false, //状态记录
        addRecodeForm: {
            //新增报告数据
            id: "",
            reportPoint: "",
            reportPerson: "",
            reportTime: "",
            recordTime: "",
            recordPerson: "",
            describes: ""
        },
        saveReportType:0,//0是新建 1是修改
        signalData: [], //监控目标数据
        flightData: [], //飞行进程数据
        alarmData:[
            
        ],//告警记录数据
        AlarmDetailsData:[],//告警记录详情数据
        RescueReportData:[],//救援报告信息数据
        ReportListTableData:[],//协助救援报告列表数据
        ReportListTableObj:{},
        infosData: [],
        ishideleftNav: true,
        isshowBg3: false,
        RegistrationNumbers :[],//航空器注册号

        // server_Url:'http://212.64.57.59:10009/kyjs/',//加载后台管理系统
        // server_Url:'http://127.0.0.1:10009/kyjs/',
        // server_Url:'http://192.168.8.109:10009/kyjs/',
        server_Url:'http://dkjs.system.op-fly.cn/',
        // server_Url:'http://192.168.1.5:10009/kyjs/',
        
        flyProcessInfo: {
            actualTakeoffTime: "",
            createTime: "2011-11-11 11-11-11",
            processState :"",
            aircraftNumber:""
        },//飞机进程详细信息
        FlightBriefingInfo:{
            
        },//飞行进程简报
        addFlyProcessInfo:{
            processState:"",
            aircraftNumber:"",
            actualTakeoffTimeStr:"",
            actualLandingTimeStr:"",
            actualLandingGear:"",
            flyPlanCode:"",
            estimatedTakeoffTimeStr:"",
            estimatedLandingTimeStr:"",
            projectedShelf:"",
            initServerStation:"",
            contacts:"",
            alarmLevel:"",
            currentServerStation:"",
            alarmCode:"",
            createTimeStr:"",
            flyRule:""
        },//新增飞行进程
        StateRecord: {
            currentState: "string",
        },
        code:"000000",
        ReportRecordInfo: [],//报告记录列表
        StateRecordsInfo: [],//状态记录列表
        aircraftInfo: {},
        resultCount:null,//航迹频率
        resultVar:null,
        settingData: { //设置-选项卡的数据
            showSettingbox :false,

            
            showSettingPlanProcess:false,//计划进程
            showSettingZHGJ:false,//综合告警
            showSettingQBFF:false,//情报分发
            showSettingHotbox:false,//应急救援
            showSettingTJ:false,//统计
            activeNavtab: 'first', //设置弹窗切换的当前活跃项
            unit:"1",//单位转换
            Scutcheon: true,//标牌显示隐藏
            wakeOpacity:false,//尾迹显示隐藏
            showSettingGJSZ:false,//告警设置显示隐藏
            areaGJ:[],
            areaYZ:[],
			settingval2: '',
            settingGJSZval:'',
			SpeedValues: [0,1500],
			HeightValues: [0,15000],
			baseinfoval3: 0,
			options: [{
				value: '0',
				label: '全部'
			}, {
				value: '1',
				label: '通航'
			}, {
				value: '2',
				label: '民航'
			}],
            mapoptions:[{
                value:'1',
                label:"地图样式1"
            },{
                value:'2',
                label:"地图样式2"
            }],
            mapvalue:'',
			airvalue:''
		},
		
		rightBarControl:{	//右侧控制活跃样式
			first:false,
			second:false,
			three:false
        },
        quXianmapData: { //高度曲线图接口参数
			targetAddress: '',
        },
        timesdata:[
            {
                time:'09:00',
            },
            {
                time:'11:00',
            },
            {
                time:'15:00',
            }
        ],
        isDraw:null,
        drawControl:null,
        editableLayers:null,
        myAtOpacitys:false,
        myAttentionOpacitys:false,//我的关注二级菜单隐藏显示
        attentionData:[],//我的关注一级菜单数据
        attSecData:[],//我的关注二级菜单数据
        AttSingle:'',
        wdgzSecondlist: { //监控目标二级弹窗分页
            curPage: 1,
            totalPage: 0,
            totalNum:0
        },
        bookmarksOpacitys:false,//书签输入备注显示隐藏
        showBookmarks: false,//书签列表
        bookmarksName:'',
        bookmarksData:[],
        bookvalue:false,
        DataNum:0,
        getTimekey:null,
    },
    created: function () {
        var _this = this;
        
        _this.getSignalNum();
        _this.getProcessNum();
        _this.getAlarmNum();
        _this.postMessages();
    },
    filters: {
        flightType(val) {
            if (val == "01") {
                return "未激活"
            } else if (val == "02") {
                return "预激活"
            } else if (val == "11") {
                return "离港"
            } else if (val == "12") {
                return "巡航"
            } else if (val == "13") {
                return "进近"
            } else if (val == "14") {
                return "着陆"
            } else if (val == "18") {
                return "移交"
            } else if (val == "19") {
                return "紧急"
            } else if (val == "21") {
                return "结束"
            } else if (val == "22") {
                return "取消"
            }
        },
        noneDefalut(val){
        	if(val == null || val =='' || val == undefined){
        		return 0;
        	} else {
        		return val
        	}
        }
    },

    computed: {
		sumAmount() {
			return this.signalData.map(
				row => row.count).reduce(
				(acc, cur) => (cur + acc), 0)
		},
	},

    mounted: function () {
        this.getUser()
        this.initMap()
        this.nowTimes()
        this.InitFlyBriefingMap();
        this.InitAlarmMap()
        
        this.initGeojsonZJ1();
        this.initGeojsonZJ2();
        this.initGeojsonZJ3();

    },
    
    methods: {
        getUser(){
            var _this = this;
            var StrA = localStorage.getItem('userInfo');
            
            // console.log(StrA)
            if(StrA == null){

                // window.location.href = _this.server_Url;   
            }else{
                _this.userInfo = JSON.parse(StrA);
                 // 获取用户信息
                if(_this.userInfo.pointsDecimal == null || _this.userInfo.pointsDecimal == ""){
                    // _this.userInfo.pointsDecimal = '[29.618493015610223, 106.6510945558548]';重庆
                    // _this.userInfo.pointsDecimal = '[30.377777777777776,120.04916666666666]';德清
                    _this.userInfo.pointsDecimal = '[31.22314,121.48132]';//上海
                }
                if(_this.userInfo.geojson == null || _this.userInfo.geojson == {}){
                    _this.userInfo.geojson = {
                        "type": "FeatureCollection",
                        "features": [
                            {
                                "type": "Feature",
                                "properties": null,
                                "geometrys": null,
                                "geometrysNew": {
                                    "type": "Polygon",
                                    "coordinates": [
                                        [
                                            [
                                                105.85839,
                                                30.38474
                                            ],
                                            [
                                                105.3476,
                                                28.55487
                                            ],
                                            [
                                                105.84191,
                                                28.91735
                                            ],
                                            [
                                                106.36368,
                                                28.52714
                                            ],
                                            [
                                                106.86348,
                                                28.714
                                            ],
                                            [
                                                107.97293,
                                                28.96681
                                            ],
                                            [
                                                109.14542,
                                                28.25473
                                            ],
                                            [
                                                108.78861,
                                                29.46244
                                            ],
                                            [
                                                108.54695,
                                                30.7155
                                            ]
                                        ]
                                    ]
                                }
                            }
                        ]
                    }
                }
            }
        },
        initGeoJson(geoJSON) {
            var _this = this;
            // console.log(geoJSON);
            if(_this.userGeoLayer != null){
                        
                _this.userGeoLayer.clearLayers();
                _this.userGeoLayer = null
            }
            var strA = JSON.stringify(geoJSON);

            var strB = strA.replace(/geometrysNew/, "geometry");
            var strC = strB.replace(/geometrys/ig,"geometry");

            var jsonD = JSON.parse(strC);


            var myStyle = {
                "color": "#062e4d",
                "weight": 3,
                "opacity": 0.65
            }; 
            _this.userGeoLayer = L.geoJSON(jsonD, {
                style: myStyle,
                pointToLayer:function(geoJsonPoint, latlng){
                    return L.marker(latlng,{
                        icon: new L.icon({
                            iconUrl: 'images/map_postion.png',
                            iconSize:[19,19]
                        })
                    });
                }
            });
            // this.map.setView(e.target.getLatLng(), 10);
            _this.map.addLayer(_this.userGeoLayer);
        },
        initMap() {
            // 地图加载
            var _this = this;
            _this.mapLayer = [{
                mapName:"电子图（浅）",
                mapUrl:'http://support.supermap.com.cn:8090//iserver/services/map-china400/rest/maps/China_4326'
            },
            // {
            //     mapName:"电子图（深）",
            //     mapUrl:"http://support.supermap.com.cn:8090/iserver/services/map-world/rest/maps/World"
            // },
            {
                mapName:"卫星影像图",
                mapUrl:"http://123.206.185.152:8090/iserver/services/map-new424/rest/maps/image"
            },
            {
                mapName:"航图",
                mapUrl:"http://123.206.185.152:8090/iserver/services/map-new424/rest/maps/main"
            }];
            // , {noWrap:true})
            
            _this.map = L.map('map', {
                crs:L.CRS.EPSG4326,
                preferCanvas: true,
                center: JSON.parse(_this.userInfo.pointsDecimal.replace(/""/ig,"")),
                maxZoom: 18,
                zoom: _this.zoomIndex,
                zoomControl: false,
                logoControl: true
                // 设置图层数组
                // layers: [China]
            });
            //鼠标移动坐标值
            L.control.mousePosition().addTo(_this.map);
           
            
            // L.control.zoom().addTo(this.map).setPosition('topright');
            _this.map.on('zoomend',function(){
                _this.zoomIndex = _this.map.getZoom();
                console.log(_this.zoomIndex)
                if(_this.setPositionKey !=null){
                    _this.setPositionKey.remove();
                    _this.setPositionKey =null;
                }
                if(_this.zoomIndex >= 9){
                    //比例尺
                    _this.setPositionKey = L.control.scale().addTo(_this.map).setPosition('bottomleft');
                }
                if(_this.vhfValue){
                    _this.openVHFRadio()
                }else{
                    _this.closeVHFRadio();
                }
                
                if(_this.adsbValue){
                    _this.openFlight()
                }else{
                    _this.closeFlight();
                }
                if(_this.emergencyResources){
                    _this.openEmergencyResources()
                }else{
                    _this.closeEmergencyResources();
                }
                
                
            })
            
            _this.MainMap = L.supermap.tiledMapLayer('http://123.206.185.152:8090/iserver/services/map-new424/rest/maps/image').addTo(_this.map);
            
            // // //测距
            // L.Control.measureControl().addTo(_this.map).setPosition('topright');
           
            _this.initGeoJson(_this.userInfo.geojson);
           
            // _this.getData();
            if(_this.getTimekey != null){
                clearInterval(_this.getTimekey);
            }
            
            _this.getTimekey = setInterval(function(){
                _this.getData();
            },1000);
        },
        InitFlyBriefingMap(){
            //飞行简报 - 地图
            var _this = this;
            _this.rightMaps = L.map('rightMaps', {
                crs:L.CRS.EPSG4326,
                preferCanvas: true,
                center: JSON.parse(_this.userInfo.pointsDecimal.replace(/""/ig,"")),
                maxZoom: 18,
                zoom: _this.zoomIndex,
                zoomControl: false,
                logoControl: true,
                trackResize: true,
                // 设置图层数组
                // layers: [China]
            });
        }, 
        InitAlarmMap(){
            //救援报告-地图
            this.AlarmMaps = L.map('AlarmMaps', {
                crs:L.CRS.EPSG4326,
                preferCanvas: true,
                center: JSON.parse(this.userInfo.pointsDecimal.replace(/""/ig,"")),
                maxZoom: 18,
                zoom: this.zoomIndex ,
                zoomControl: false,
                logoControl: true,
                trackResize: true,
                // 设置图层数组
                
            });
        }, 
        setWake(){
            // 设置-基础设置-尾迹显示隐藏
            console.log(this.settingData.wakeOpacity);

        },
        setScutcheon(){
            //设置---基础设置--标牌显示隐藏
            console.log(this.settingData.Scutcheon);
        },
        setHeight(){
            //设置---基础设置--高度过滤
            console.log(this.settingData.HeightValues)
        },
        setSpeed(){
            //设置---基础设置--速度过滤
            console.log(this.settingData.SpeedValues)
        },
        setUnit(){
            // 设置-基础设置- 单位切换
            console.log(this.settingData.unit)
        },
        chooseAir(){
            // 设置---目标过滤 -- 航空器选择
            
            console.log(this.settingData.airvalue)
        },
        goset() {
            // 跳转后台界面按钮
            // window.open(this.server_Url+"#/user");
        },
        closeMap(){
            //退出地图界面
            localStorage.removeItem('userInfo');
            // window.open(_this.server_Url);
        },
        setMapClick(){
            // 地图样式选择
            this.isSetMap = !this.isSetMap
        },
        flyProcessTransfer () {
            //计划进程 -- 飞行进程收发
            var self = this;
            self.transferOpacitys = !self.transferOpacitys;
            transferRecord_selectAll({}).then(function(response) {
                // console.log(response)
                if(response.status == 200) {
                   self.flyProcessTableData = response.data.ts;
                   
                }
            })
            .catch(function(error) {
                console.log(error);
            });
        },
        closetramsfer(){
            var _this =this;
            if(_this.transferOpacitys)
            _this.transferOpacitys =false;
        },
        openQBFF(){
            // 综合告警 -- 情报分发
            this.isQBFF = !this.isQBFF;
            // console.log(this.isQBFF);
        },
        eventTransfer () {
            //应急救援 --- 应急事件
            var self = this;
            self.emergencyEvent = !self.emergencyEvent;
            var dataObj = {};
            if(self.emergencyEvent){
                emergencyEvents_selectAll(dataObj).then(function(response) {
                    console.log(response)
                    if(response.status == 200) {
                    //    self.emergencyTableData = response.data.emergencyEvents[0];
                       self.emergencyTableData = response.data.emergencyEvents;
                    }
                }).catch(function(error) {
                    console.log(error);
                });
            }
            
        },
        addEmergency(){
            // 应急事件 --- 新增事件
            this.emergencyOpacitys = true;
            this.addEmergencyForm = {};
        },
        closeAddEmer(){
            // 新增应急事件 --- 关闭事件
            this.emergencyOpacitys = false;
        },
        saveEmergency(){
            var _this = this;
            var dataObj = {
                "emergencyEvents": {
                    "aircraftRegNumber": _this.addEmergencyForm.aircraftRegNumber,
                    "coordinate": _this.addEmergencyForm.coordinate,
                    "createTime": "",
                    "createUser": _this.userInfo.userRightInfo.userName,
                    "describe": "",
                    "emergencyContact": _this.addEmergencyForm.emergencyContact,
                    "emergencyContactPhone": _this.addEmergencyForm.emergencyContactPhone,
                    "emergencyLevel": _this.addEmergencyForm.emergencyLevel,
                    "id": "",
                    "lastLocationLat": _this.addEmergencyForm.lastLocationLat,
                    "lastLocationLog": _this.addEmergencyForm.lastLocationLog,
                    "pilotId": _this.addEmergencyForm.pilotId,
                    "pilotName": _this.addEmergencyForm.pilotName,
                    "times": _this.nowTimegang
                  }
            };
            
            emergencyEvents_insert(dataObj).then(function(response){
                // console.log(response);
                if(response.data.success){
                    _this.emergencyOpacitys = false;
                    _this.emergencyEvent = false;
                    _this.eventTransfer();
                }
            })
        },
        closeEventzh () {
            // 应急事件 关闭
            var _this =this;
            if(_this.emergencyEvent)
            _this.emergencyEvent =false;
        },
        addRRlist(row){
            var _this = this;
            //应急列表 ---  应急数据提交
            // console.log(row);
            
            
            // 把应急事件里的数据 提交到 协助救援报告列表 
            rescueReport_insert({
                "rr": {
                    "aircraft_number": row.aircraftRegNumber,
                    "distress_alarm_time": row.times,
                    "emergency_contact_number": row.emergencyContactPhone,
                   
                    "last_position_lat": row.lastLocationLat,
                    "last_position_log": row.lastLocationLog,
                    "personnel_number": 0,
                    "pilot_id": row.pilotId,
                    "pliot_name": row.pilotName,
                    "alarm_type": "MTSL",
                    
                  }
            }).then(function(res){
                // 修改应急事件里对应数据的提交状态值 0:未提交  1:已提交
                emergencyEvents_update({
                    "emergencyEvents": {
                        "id":row.id,
                        "submitState":'1'
                    }
                }).then(function(res){
                    _this.emergencyEvent = false;
                    _this.eventTransfer();
                    _this.$message({
                        message: row.aircraftRegNumber+'应急报告成功提交到协助救援报告中',
                        type: 'success'
                    });
                })
                
            })
        },
        selRRinfo(val){
            console.log(val);
            //应急救援 ---救援报告
            var row = {
                
                alarm_type:"MTSL"
            }
            var _this =this;
            // console.log(row)
            // console.log(row.alarm_type.indexOf("M"))
            if(row.alarm_type.indexOf("M") == 0){
                //告警类型首字母是 M 的，才能打开救援报告
                _this.RescueReportOpacitys = !_this.RescueReportOpacitys;
                if(_this.RescueReportOpacitys){
                    rescueReport_selectAll({
                        id:val.id,
                        alarm_type:row.alarm_type
                    }).then(function (res) {
                        
                        if (res.status == 200) {
                            
                            var China = L.supermap.tiledMapLayer('http://123.206.185.152:8090/iserver/services/map-new424/rest/maps/image').addTo(_this.AlarmMaps);
                            // console.log(res.data.rescueReport[0])
                            _this.RescueReportData = res.data.rescueReport[0];
                            _this.RescueReportData.position = "[经度:"+res.data.rescueReport[0].last_position_lat+"纬度:"+res.data.rescueReport[0].last_position_log+"]";
                            //预测轨迹数组
                            _this.RescueReportData.predictingTrajectory = [
                                [29.668493015610223, 106.7010945558548],
                                [29.718493015610223, 106.7510945558548],
                                [29.768493015610223, 106.8010945558548],
                                [29.818493015610223, 106.8510945558548],
                                [29.868493015610223, 106.9010945558548]];
                            //历史轨迹
                            _this.RescueReportData.historyTrajectory = [
                                [29.618493015610223, 106.6510945558548],
                                [29.568493015610223, 106.6510945558548],
                                [29.518493015610223, 106.6510945558548],
                                [29.468493015610223, 106.6510945558548],
                                [29.418493015610223, 106.6510945558548]];
                            
                            var HT = _this.RescueReportData.historyTrajectory;
                            if(_this.historyTrajectoryLayer != "")
                            {
                                _this.historyTrajectoryLayer = ""
                            }
                            
                            _this.historyTrajectoryLayer = L.polyline(HT, {color: '#0080FF'})
                            _this.AlarmMaps.addLayer(_this.historyTrajectoryLayer);
                           
                            
                            _this.historyTrajectoryLastPoint = L.circle([HT[0][0],HT[0][1]],{
                                color: 'red',
                                fillColor: '#0080FF',
                                fillOpacity: 0.000001,
                                dashArray: "5",
                                radius: 0.5
                            })
                            _this.AlarmMaps.addLayer(_this.historyTrajectoryLastPoint);
                            //-----------------------------------------
                            var PT = _this.RescueReportData.predictingTrajectory;
                            if(_this.predictingTrajectoryLayers.length > 0)
                            {
                                _this.predictingTrajectoryLayers = [];
                                _this.predictingTrajectoryGroup.clearLayers();
                            }
                            for(var j = 0 ; j< PT.length; j++)
                            {
                                _this.predictingTrajectoryLayers.push(
                                    L.circleMarker([PT[j][0],PT[j][1]], {
                                        color: '#0080FF',
                                        fillColor: '#0080FF',
                                        radius: 0.5,
                                        fillOpacity: 1
                                    }) 
                                )
                            }
                            if(_this.predictingTrajectoryLayers.length > 0)
                            {
                                _this.predictingTrajectoryGroup = L.layerGroup(_this.predictingTrajectoryLayers);
                                _this.AlarmMaps.addLayer(_this.predictingTrajectoryGroup);
                            }
                            // console.log(_this.RescueReportData);
                        }
                    }).catch(function (err) {
                        console.log(err)
                    });
                }
            }
        },
        giveRescueReport(){
            //应急救援 ---救援报告
            var row = {
                alarm_type:"MTSL"
            }
            var _this =this;
            // console.log(row)
            // console.log(row.alarm_type.indexOf("M"))
            if(row.alarm_type.indexOf("M") == 0){
                //告警类型首字母是 M 的，才能打开救援报告
                _this.RescueReportListOpacitys = !_this.RescueReportListOpacitys;
                if(_this.RescueReportListOpacitys){
                    rescueReport_selectAll({
                        alarm_type:row.alarm_type
                    }).then(function (res) {
                        
                        if (res.status == 200) {
                            if(_this.ReportListTableData.length >0 ){
                                _this.ReportListTableData = [];
                                _this.ReportListTableObj = {};
                            }
                            for(var i=0;i<res.data.rescueReport.length;i++){
                                _this.ReportListTableObj = res.data.rescueReport[i];
                                _this.ReportListTableObj.position = "[经度:"+res.data.rescueReport[i].last_position_lat+"纬度:"+res.data.rescueReport[i].last_position_log+"]";
                                _this.ReportListTableData.push(_this.ReportListTableObj);
                            }
                        }
                    }).catch(function (err) {
                        console.log(err)
                    });
                }
            }
        },
        closeReportList(){
            this.RescueReportListOpacitys = false;
        },
        saveQBFF(){
            var _this = this;
            intelligenceDistribution_insert({
                "s": {
                    "aircraftRegNumber":_this.IntelligenceDistribution.aircraftRegNumber,
                    "effectiveEnd": _this.IntelligenceDistribution.effectiveEnd,
                    "effectiveStart": _this.IntelligenceDistribution.effectiveStart,
                    "id": "1",
                    "intelligenceContent": _this.IntelligenceDistribution.intelligenceContent,
                    "intelligenceType": _this.IntelligenceDistribution.intelligenceType,
                    "remark": _this.IntelligenceDistribution.remark,
                    "sendFss": _this.IntelligenceDistribution.sendFss,
                    "sendPeople": _this.IntelligenceDistribution.sendPeople,
                    "sendTime": _this.IntelligenceDistribution.sendTime
                  }
            }).then(function (res) {
                _this.$message({
                    message: '新增情报分发信息成功',
                    type: 'success'
                });
                _this.isQBFF = false;
            }).catch(function(err){
                _this.$message.error("新增情报分发信息失败");
            })
            // console.log(_this.IntelligenceDistribution.aircraftRegNumber);
        },
        setMapLayer(infos,index) {
            // 地图图层样式选中
            var _this = this;
            if(_this.MainMap != null){
                _this.MainMap.remove();
            }
            _this.MainMap = L.supermap.tiledMapLayer(infos).addTo(_this.map);


            _this.enroteValue = false;
            if(_this.enroteLayer !=null){
                _this.enroteLayer.remove();
            }
            _this.airportValue =false;
            if(_this.airportLayer !=null){
                _this.airportLayer.remove();
            }
            _this.ctrlairspaceValue = false;
            if(_this.ctrlairspaceLayer !=null){
                _this.ctrlairspaceLayer.remove();
            }
            _this.restairspaceValue = false;
            if(_this.restairspaceLayer !=null){
                _this.restairspaceLayer.remove();
            }
        },
        nowTimes() {
            // 系统时间
            var self = this;
            self.timeFormate(new Date());
			setInterval(function(){
				self.timeFormate(new Date())
			}, 1000);
        },
        timeHMS(timeStamp){
            let hh = new Date(timeStamp).getHours() < 10 ? "0" + new Date(timeStamp).getHours() : new Date(timeStamp).getHours();
            let mm = new Date(timeStamp).getMinutes() < 10 ? "0" + new Date(timeStamp).getMinutes() : new Date(timeStamp).getMinutes();
            let ss = new Date(timeStamp).getSeconds() < 10 ? "0" + new Date(timeStamp).getSeconds() : new Date(timeStamp).getSeconds();
            let times = hh + ":" + mm + ":" + ss;
            return times
        },
        timeHM(timeStamp){
            let hh = new Date(timeStamp).getHours() < 10 ? "0" + new Date(timeStamp).getHours() : new Date(timeStamp).getHours();
            let mm = new Date(timeStamp).getMinutes() < 10 ? "0" + new Date(timeStamp).getMinutes() : new Date(timeStamp).getMinutes();
            let times = hh + ":" + mm ;
            return times
        },
        timeFormate(timeStamp) {
            let year = new Date(timeStamp).getFullYear();
            let month = new Date(timeStamp).getMonth() + 1 < 10 ? "0" + (new Date(timeStamp).getMonth() + 1) : new Date(timeStamp).getMonth() + 1;
            let date = new Date(timeStamp).getDate() < 10 ? "0" + new Date(timeStamp).getDate() : new Date(timeStamp).getDate();
            let hh = new Date(timeStamp).getHours() < 10 ? "0" + new Date(timeStamp).getHours() : new Date(timeStamp).getHours();
            let mm = new Date(timeStamp).getMinutes() < 10 ? "0" + new Date(timeStamp).getMinutes() : new Date(timeStamp).getMinutes();
            let ss = new Date(timeStamp).getSeconds() < 10 ? "0" + new Date(timeStamp).getSeconds() : new Date(timeStamp).getSeconds();
            this.nowTime = year + "年" + month + "月" + date + "日" + " " + hh + ":" + mm + ":" + ss;
            this.nowTimegang = year + "-" + month + "-" + date + " " + hh + ":" + mm + ":" + ss;
            this.executorDate = year + "-" + month + "-" + date;
            
        },


        handleSelect(key, keyPath) {
            // 头部导航按钮选择
            var self = this;
			if(key == 1){
                self.settingData.showSettingbox = !self.settingData.showSettingbox;
                self.settingData.showSettingPlanProcess = false;
                self.settingData.showSettingZHGJ = false;
                self.settingData.showSettingQBFF = false;
                self.settingData.showSettingHotbox = false;
                self.settingData.showSettingTJ = false;
                self.settingData.showSettingGJSZ = false;
			}else if(key == 2){
                self.settingData.showSettingbox = false;
                self.settingData.showSettingPlanProcess = !self.settingData.showSettingPlanProcess;
                self.settingData.showSettingZHGJ = false;
                self.settingData.showSettingQBFF = false;
                self.settingData.showSettingHotbox = false;
                self.settingData.showSettingTJ = false;
                self.settingData.showSettingGJSZ = false;
            }else if(key == 3){
                self.settingData.showSettingbox = false;
                self.settingData.showSettingPlanProcess = false;
                self.settingData.showSettingZHGJ = !self.settingData.showSettingZHGJ;
                self.settingData.showSettingQBFF = false;
                self.settingData.showSettingHotbox = false;
                self.settingData.showSettingTJ = false;
                self.settingData.showSettingGJSZ = false;
            }else if(key == 4){
                self.settingData.showSettingbox = false;
                self.settingData.showSettingPlanProcess = false;
                self.settingData.showSettingZHGJ = false;
                self.settingData.showSettingQBFF = !self.settingData.showSettingQBFF;
                self.settingData.showSettingHotbox = false;
                self.settingData.showSettingTJ = false;
                self.settingData.showSettingGJSZ = false;
            }else if(key == 5){
                self.settingData.showSettingbox = false;
                self.settingData.showSettingPlanProcess = false;
                self.settingData.showSettingZHGJ = false;
                self.settingData.showSettingQBFF = false;
                self.settingData.showSettingHotbox = !self.settingData.showSettingHotbox;
                self.settingData.showSettingTJ = false;
                self.settingData.showSettingGJSZ = false;
            }
            else if(key == 9){
                self.settingData.showSettingbox = false;
                self.settingData.showSettingPlanProcess = false;
                self.settingData.showSettingZHGJ = false;
                self.settingData.showSettingQBFF = false;
                self.settingData.showSettingHotbox = false;
                self.settingData.showSettingTJ = !self.settingData.showSettingTJ;
                self.settingData.showSettingGJSZ = false;
            }else if(key == 10){
                self.settingData.showSettingbox = false;
                self.settingData.showSettingPlanProcess = false;
                self.settingData.showSettingZHGJ = false;
                self.settingData.showSettingQBFF = false;
                self.settingData.showSettingHotbox = false;
                self.settingData.showSettingTJ = false;
                self.settingData.showSettingGJSZ = !self.settingData.showSettingGJSZ;
                self.ClickGJZS();
            }
        },
      
        getData() {
            var _this = this;
            //根据地图中心点获取范围内的飞行数据
           
            // console.log(JSON.parse(_this.userInfo.pointsDecimal.replace(/""/ig,"")))
            map_plane({
                "lng": JSON.parse(_this.userInfo.pointsDecimal.replace(/""/ig,""))[1],
                "lat": JSON.parse(_this.userInfo.pointsDecimal.replace(/""/ig,""))[0],
                "range": "200"
            }).then(function (response) {
                   
                    var flydatas = response.data;
                    alarmRecord_selectAll({
                        id:""
                    }).then(function (res) {
                        
                        if (res.status == 200) {
                          
                            if(flydatas != null){
                                
                                _this.renderMarker(flydatas,res.data);
                            }
                        }
                    }).catch(function (err) {
                        console.log(err)
                        if (_this.flightLayerGroup != null) {
                            _this.flightLayerGroup.clearLayers();
                            _this.flightLayers = [];
                        }
                        // _this.getData();
                    });
                })
                .catch(function (error) {
                    console.log(error);
                    if (_this.flightLayerGroup != null) {
                        _this.flightLayerGroup.clearLayers();
                        _this.flightLayers = [];
                    }
                    // _this.getData();
                });
        },
        getCenterPoint() {
            //获取地图中心点
            var centerPoint = this.map.getCenter();
            
            return {
                "lng": centerPoint.lng,
                "lat": centerPoint.lat,
                "range": "1500"
            };
        },
        ClearLayers() {
            var _this = this;
            //清除分组数据
            if (_this.flightLayerGroup != null) {
                _this.flightLayerGroup.clearLayers();
                _this.flightLayers = [];
                //清空标牌 
                if (_this.flightScutcheonLayers.length > 0) {
                    _this.flightScutcheonLayers = [];
                    _this.flightScutcheonLayersGroup.clearLayers();
                }
                //清空尾迹
                if(_this.flightTrackLayers.length > 0)
                {
                    _this.flightTrackLayers = [];
                    _this.flightTrackLayersGroup.clearLayers();
                }
            }
            //清除历史轨迹
            if(_this.historyTrajectoryLayers.length > 0)
            {
                _this.historyTrajectoryLayers = [];
                _this.historyTrajectoryGroup.clearLayers();
            }
            //清除预测轨迹
            if(_this.predictingTrajectoryLayers.length > 0)
            {
                _this.predictingTrajectoryLayers = [];
                _this.predictingTrajectoryGroup.clearLayers();
            }
        },
        isSelectFlight(row) {
            
            return this.selectedflight != null && this.selectedflight.options.alt == row.cat021Bean
                .targetAddress;
        },
        renderMarker(flydatas,alarmdatas) {
           
            var _this = this;
            //清除分组数据
            _this.ClearLayers();

            var res = flydatas.cat021Infos;
            // console.log(res);
            // console.log(res[0].cat021Bean.lat,res[0].cat021Bean.log)
            var alarmres = alarmdatas.alarmRecord;
            
            if(alarmres == null){
                alarmres = 0;
            }
            var minHeight = _this.settingData.HeightValues[0];
            var maxHeight =_this.settingData.HeightValues[1];
            var minSpeed = _this.settingData.SpeedValues[0];
            var maxSpeed = _this.settingData.SpeedValues[1];
            // var alarmres = "";
           
            

            var flightMarker, iconUrl="", iconSize,className="",airType,aircraftType,
                zoomindex = _this.map.getZoom(),
                isSelectFlight,taddressArr=[],taddressTypeArr=[],ptArr = [];
            //告警飞机
            for(var ai = 0;ai < alarmres.length;ai++){
                let taddress = alarmres[ai].alarm_source_number;
                taddressArr.push(taddress);
                taddressTypeArr.push(alarmres[ai].alarm_type)
            }
            //重新加载飞机
           
            if(res != null && res.length !=null){
                
                for (var i = 0; i < res.length; i++) {
                    //当前飞机是否选中
                    isSelectFlight = _this.isSelectFlight(res[i]);
                    let targetAddress = res[i].cat021Bean.targetAddress,
                        lat = res[i].cat021Bean.lat, //经度
                        log = res[i].cat021Bean.log, // 维度
                        heading = res[i].cat021Bean.heading, //航向
                        airType = res[i].cat021Bean.airType,//2 是民航  1是通航
                        aircraftType = res[i].cat021Bean.aircraftType,//通航航空器类型标识
                        height = Math.round(res[i].cat021Bean.height* 0.3048),//高度
                        groundSpeed = Math.round(res[i].cat021Bean.groundSpeed*1852); 
                        
                    if(height >= minHeight && height <= maxHeight && groundSpeed>= minSpeed && groundSpeed <= maxSpeed){
                       
                        if(taddressArr.indexOf(targetAddress)>=0){
                        
                            // 飞机targetAddress 与 告警飞机alarm_source_number 相同，则显示告警图片
        
                            let alarm_type = taddressTypeArr[taddressArr.indexOf(targetAddress)];
                            
                            // console.log(alarm_type)
                            if (zoomindex >= 10) {
                                
                                if (isSelectFlight) {
                                    
                                    if(alarm_type.indexOf("M") == 0 ){
                                        if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                            if(airType == 2){
                                                iconUrl = 'images/air/red-dashed-on.png';
                                            }else{
                                                //setOnAlarm，setAlarm，setOnFly,setFly方法在newGroup.js文件里
                                                iconUrl = setOnAlarm(aircraftType);
                                            }
                                            
                                        }else if(_this.settingData.airvalue == 2){
                                            if(airType == 2){
                                                iconUrl = 'images/air/red-dashed-on.png';
                                            }else {
                                                continue;
                                            }
                                        }else{
                                            if(airType == 1){
                                                iconUrl = setOnAlarm(aircraftType);
                                            }else{
                                                continue;
                                            }
                                        }
                                        
                                        //历史轨迹
                                        for(var j = 0 ; j< res[i].planePointInfos.length; j++)
                                        {
                                            _this.historyTrajectoryLayers.push(
                                                L.circleMarker([res[i].planePointInfos[j].latitude,res[i].planePointInfos[j].longitude], {
                                                    color: '#0080FF',
                                                    fillColor: '#0080FF',
                                                    radius: 0.5,
                                                    fillOpacity: 1
                                                }) 
                                            )
                                        }
                                        if(_this.historyTrajectoryLayers.length > 0)
                                        {
                                            _this.historyTrajectoryGroup = L.layerGroup(_this.historyTrajectoryLayers);
                                            _this.map.addLayer(_this.historyTrajectoryGroup);
                                        }
        
                                        //预测轨迹
                                        if(0< heading && heading <= 90){
                                            for(var lx=0;lx<5;lx++){
                                                let ptx = lat + 0.05*(lx+1);
                                                let pty = log + 0.05*(lx+1);
                                                ptArr.push([ptx,pty])
                                            }
                                            
                                        }else if(90<heading && heading <=180){
                                            for(var lx=0;lx<5;lx++){
                                                let ptx = lat - 0.05*(lx+1);
                                                let pty = log + 0.05*(lx+1);
                                                ptArr.push([ptx,pty])
                                            }
                                            
                                        }else if(180<heading && heading <=270){
                                            for(var lx=0;lx<5;lx++){
                                                let ptx = lat - 0.05*(lx+1);
                                                let pty = log - 0.05*(lx+1);
                                                ptArr.push([ptx,pty])
                                            }
                                            
                                        }else if(270 < heading && heading <=360){
                                            for(var lx=0;lx<5;lx++){
                                                let ptx = lat + 0.05*(lx+1);
                                                let pty = log - 0.05*(lx+1);
                                                ptArr.push([ptx,pty])
                                            }
                                            
                                        }
                                        
                                        
                                        for(var j = 0 ; j< ptArr.length; j++)
                                        {
                                            _this.predictingTrajectoryLayers.push(
                                                L.circleMarker([ptArr[j][0],ptArr[j][1]], {
                                                    color: 'red',
                                                    fillColor: '#0080FF',
                                                    radius: 0.5,
                                                    fillOpacity: 1
                                                }) 
                                            )
                                        }
                                        if(_this.predictingTrajectoryLayers.length > 0)
                                        {
                                            _this.predictingTrajectoryGroup = L.layerGroup(_this.predictingTrajectoryLayers);
                                            _this.map.addLayer(_this.predictingTrajectoryGroup);
                                        }
                                    }else{
                                        if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                            if(airType == 2){
                                                iconUrl = 'images/air/aircraft-alarm-red-on.png';
                                            }else{
                                                iconUrl = setOnAlarm(aircraftType);
                                            }
                                        }else if(_this.settingData.airvalue == 2){
                                            if(airType == 2){
                                                iconUrl = 'images/air/aircraft-alarm-red-on.png';
                                            }else {
                                                continue;
                                            }
                                        }else{
                                            if(airType == 1){
                                                iconUrl = setOnAlarm(aircraftType);
                                            }else{
                                                continue;
                                            }
                                        }
                                        
                                    }
                                    iconSize = [82, 82];
                                } else {
                                    
                                    if(alarm_type.indexOf("M") == 0 ){
                                        //遇险标志  显示虚线飞机
                                        if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                            if(airType == 2){
                                                iconUrl = 'images/air/red-dashed.png';
                                                className = 'opacity_alarmFly';
                                            }else{
                                                
                                                iconUrl = setAlarm(aircraftType);
                                                className= '';
                                            }
                                        }else if(_this.settingData.airvalue == 2){
                                            if(airType == 2){
                                                iconUrl = 'images/air/red-dashed.png';
                                                className = 'opacity_alarmFly';
                                            }else{
                                                continue;
                                            }
                                        }else{
                                            if(airType == 1){
                                                iconUrl = setAlarm(aircraftType);
                                                className= '';
                                            }else{
                                                continue;
                                            }
                                        }
                                    }else{
                                        if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                            if(airType == 2){
                                                iconUrl = 'images/air/aircraft-alarm-red.png';
                                            }else{
                                                iconUrl = setAlarm(aircraftType);
                                            }
                                        }else if(_this.settingData.airvalue == 2){
                                            if(airType == 2){
                                                iconUrl = 'images/air/aircraft-alarm-red.png';
                                            }else {
                                                continue;
                                            }
                                        }else{
                                            if(airType == 1){
                                                iconUrl = setAlarm(aircraftType);
                                            }else{
                                                continue;
                                            }
                                        }
                                        className= '';
                                    }
                                    iconSize = [70, 70];
                                    // className = "flightIcon_big"
                                }
                                //显示尾迹 
                                if(_this.settingData.wakeOpacity){
                                    for(var j = 0 ; j< res[i].planePointInfos.length; j++)
                                    {
                                        _this.flightTrackLayers.push(
                                            L.circleMarker([res[i].planePointInfos[j].latitude,res[i].planePointInfos[j].longitude], {
                                                color: '#0080FF',
                                                fillColor: '#0080FF',
                                                radius: 0.5,
                                                fillOpacity: 1
                                            })
                                            // .bindTooltip("【"+targetAddress+"】-【"+j+"】-【"+res[i].planePointInfos[j].lat+","+res[i].planePointInfos[j].log+"】")
                                        )
                                    } 
                                }
                                
                            } else if (zoomindex >= 7 && zoomindex < 10) {
                                if (isSelectFlight) {
                                    if(alarm_type.indexOf("M") == 0 ){
                                        if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                            if(airType == 2){
                                                iconUrl = 'images/air/red-dashed-on.png';
                                            }else{
                                                iconUrl = setOnAlarm(aircraftType);
                                            }
                                        }else if(_this.settingData.airvalue == 2){
                                            if(airType == 2){
                                                iconUrl = 'images/air/red-dashed-on.png';
                                            }else {
                                                continue;
                                            }
                                        }else{
                                            if(airType == 1){
                                                iconUrl = setOnAlarm(aircraftType);
                                            }else{
                                                continue;
                                            }
                                        }
                                        iconSize = [50, 50];
                                    }else{
                                        if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                            if(airType == 2){
                                                iconUrl = 'images/air/aircraft-alarm-red-on.png';
                                            }else{
                                                iconUrl = setOnAlarm(aircraftType);
                                            }
                                        }else if(_this.settingData.airvalue == 2){
                                            if(airType == 2){
                                                iconUrl = 'images/air/aircraft-alarm-red-on.png';
                                            }else {
                                                continue;
                                            }
                                        }else{
                                            if(airType == 1){
                                                iconUrl = setOnAlarm(aircraftType);
                                            }else{
                                                continue;
                                            }
                                        }
                                        iconSize = [50, 50];
                                    }
                                    
                                } else {
                                    // console.log(_this.settingData.airvalue+"告警")
                                    if(alarm_type.indexOf("M") == 0 ){
                                        //遇险标志  显示虚线飞机
                                        if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                            if(airType == 2){
                                                iconUrl = 'images/air/red-dashed.png';
                                                className = 'opacity_alarmFly';
                                            }else{
                                                iconUrl = setAlarm(aircraftType);
                                                className= '';
                                            }
                                        }else if(_this.settingData.airvalue ==2 ){
                                            
                                            if(airType == 2){
                                                iconUrl = 'images/air/red-dashed.png';
                                                className = 'opacity_alarmFly';
                                            }
                                            else{
                                                continue;
                                            }
                                        }else if(_this.settingData.airvalue ==1 ){
                                            
                                            if(airType == 1){
                                                iconUrl = setAlarm(aircraftType);
                                                className= '';
                                            }else{
                                                continue;
                                            }
                                        }
                                        iconSize = [38, 38];
                                    }else{
                                        if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                            if(airType == 2){
                                                iconUrl = 'images/air/aircraft-alarm-red.png';
                                            }else{
                                                iconUrl = setAlarm(aircraftType);
                                            }
                                            
                                        }else if(_this.settingData.airvalue ==2 ){
                                            if(airType == 2){
                                                iconUrl = 'images/air/aircraft-alarm-red.png';
                                            }else{
                                                continue;
                                            }
                                        }else if(_this.settingData.airvalue ==1 ){
                                            if(airType == 1){
                                                iconUrl = setAlarm(aircraftType);
                                            }else{
                                                continue;
                                            }
                                        }
                                        iconSize = [38, 38];
                                    }
                                   
                                }
        
                            } else {
                                if (isSelectFlight) {
                                    if(alarm_type.indexOf("M") == 0 ){
                                        if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                            if(airType == 2){
                                                iconUrl = 'images/air/red-dashed-on.png';
                                            }else{
                                                iconUrl = setOnAlarm(aircraftType);
                                            }
                                        }else if(_this.settingData.airvalue == 2){
                                            if(airType == 2){
                                                iconUrl = 'images/air/red-dashed-on.png';
                                            }else {
                                                continue;
                                            }
                                        }else{
                                            if(airType == 1){
                                                iconUrl = setOnAlarm(aircraftType);
                                            }else {
                                                continue;
                                            }
                                        }
                                    }else{
                                        if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                            if(airType == 2){
                                                iconUrl = 'images/air/aircraft-alarm-red-on.png';
                                            }else{
                                                iconUrl = setOnAlarm(aircraftType);
                                            }
                                        }else if(_this.settingData.airvalue == 2){
                                            if(airType == 2){
                                                iconUrl = 'images/air/aircraft-alarm-red-on.png';
                                            }else {
                                                continue;
                                            }
                                        }else{
                                            if(airType == 1){
                                                iconUrl = setOnAlarm(aircraftType);
                                            }else{
                                                continue;
                                            }
                                        }
                                    }
                                    iconSize = [38, 38];
        
                                    
                                } else {
                                    if(alarm_type.indexOf("M") == 0 ){
                                        //遇险标志  显示虚线飞机
                                        if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                            if(airType == 2){
                                                iconUrl = 'images/air/red-dashed.png';
                                                className = 'opacity_alarmFly';
                                            }else{
                                                iconUrl = setAlarm(aircraftType);
                                               
                                                className= '';
                                            }
                                        }else if(_this.settingData.airvalue == 2){
                                            if(airType == 2){
                                                iconUrl = 'images/air/red-dashed.png';
                                                className = 'opacity_alarmFly';
                                            }else {
                                                continue;
                                            }
                                        }else{
                                            if(airType == 1){
                                                iconUrl = setAlarm(aircraftType);
                                                className= '';
                                            }else{
                                                continue;
                                            }
                                        }
                                    }else{
                                        if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                            if(airType == 2){
                                                iconUrl = 'images/air/aircraft-alarm-red.png';
                                            }else{
                                                iconUrl = setAlarm(aircraftType);
                                            }
                                        }else if(_this.settingData.airvalue == 2){
                                            if(airType == 2){
                                                iconUrl = 'images/air/aircraft-alarm-red.png';
                                            }else {
                                                continue;
                                            }
                                        }else{
                                            if(airType == 1){
                                                iconUrl = setAlarm(aircraftType);
                                            }else{
                                                continue;
                                            }
                                        }
                                        className= '';
                                    }
                                    iconSize = [19, 19];
                                }
                                divIhtml = "";
                            }
                            //设置是否显示标牌
                            if(_this.settingData.Scutcheon){
                                _this.renderAlarmScutcheon(res[i],taddressTypeArr[taddressArr.indexOf(targetAddress)])
                            }
                            
                            // 创建飞机图标 批量生成marker
                            flightMarker = _this.renderAlarmAirMarker(res[i].cat021Bean,iconUrl,iconSize,className,alarm_type)
                            
                        }else{
                            //判断不同的缩放比例，显示不同大小的图标，显示标牌
                            if (zoomindex >= 10) {
                                if (isSelectFlight) {
                                    if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                        if(airType == 2){
                                            iconUrl = 'images/plane_big_pitch.png';
                                        }else{
                                            iconUrl = setOnFly(aircraftType);
                                        }
                                    }else if(_this.settingData.airvalue == 2){
                                        if(airType == 2){
                                            iconUrl = 'images/plane_big_pitch.png';
                                        }else {
                                            continue;
                                        }
                                    }else{
                                        if(airType == 1){
                                            iconUrl = setOnFly(aircraftType);
                                        }else {
                                            continue;
                                        }
                                    }
                                    
                                    iconSize = [82, 82];
                                    className= '';
                                } else {
                                    if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                        if(airType == 2){
                                            iconUrl = 'images/plane_big.png';
                                        }else{
                                            iconUrl = setFly(aircraftType);
                                        }
                                    }else if(_this.settingData.airvalue == 2){
                                        if(airType == 2){
                                            iconUrl = 'images/plane_big.png';
                                        }else {
                                            continue;
                                        }
                                    }else{
                                        if(airType == 1){
                                            iconUrl = setFly(aircraftType);
                                        }else {
                                            continue;
                                        }
                                    }
                                    iconSize = [76, 76];
                                    className= '';
                                }
                                //显示尾迹 
                                if(_this.settingData.wakeOpacity){
                                    for(var j = 0 ; j< res[i].planePointInfos.length; j++)
                                    {
                                        _this.flightTrackLayers.push(
                                            L.circleMarker([res[i].planePointInfos[j].latitude,res[i].planePointInfos[j].longitude], {
                                                color: '#0080FF',
                                                fillColor: '#0080FF',
                                                radius: 1.5,
                                                fillOpacity: 1
                                            })
                                            // .bindTooltip("【"+targetAddress+"】-【"+j+"】-【"+res[i].planePointInfos[j].lat+","+res[i].planePointInfos[j].log+"】")
                                        )
                                    } 
                                }
                                
                            } else if (zoomindex >= 7 && zoomindex < 10) {
                                if (isSelectFlight) {
                                    if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                        if(airType == 2){
                                            iconUrl = 'images/plane_big_pitch.png';
                                        }else{
                                            iconUrl = setOnFly(aircraftType);
                                            
                                        }
                                    }else if(_this.settingData.airvalue == 2){
                                        if(airType == 2){
                                            iconUrl = 'images/plane_big_pitch.png';
                                        }else {
                                            continue;
                                        }
                                    }else{
                                        if(airType == 1){
                                            iconUrl = setOnFly(aircraftType);
                                        }else{
                                            continue;
                                        }
                                    }
                                    
                                    iconSize = [50, 50];
                                    className= '';
                                } else {
                                    if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                        if(airType == 2){
                                            iconUrl = 'images/plane_big.png';
                                        }else{
                                            iconUrl = setFly(aircraftType);
                                        }
                                    }else if(_this.settingData.airvalue == 1){
                                        if(airType == 1){
                                            iconUrl = setFly(aircraftType);
                                        }else{
                                            continue;
                                        }
                                    }else{
                                        if(airType == 2){
                                            iconUrl = 'images/plane_big.png';
                                        }else{
                                            continue;
                                        }
                                    }
                                    iconSize = [50, 50];
                                    className= '';
                                }
                            } else {
                                if (isSelectFlight) {
                                    if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                        if(airType == 2){
                                            iconUrl = 'images/plane_big_pitch.png';
                                        }else{
                                            iconUrl = setOnFly(aircraftType);
                                        }
                                    }else if(_this.settingData.airvalue == 2){
                                        if(airType == 2){
                                            iconUrl = 'images/plane_big_pitch.png';
                                        }else {
                                            continue;
                                        }
                                    }else{
                                        if(airType == 1){
                                            iconUrl = setOnFly(aircraftType);
                                        }else{
                                            continue;
                                        }
                                    }
                                    iconSize = [38, 38];
                                    className= '';
                                } else {
                                    if(_this.settingData.airvalue == 0 || _this.settingData.airvalue == ""){
                                        if(airType == 2){
                                            iconUrl = 'images/plane_small.png';
                                        }else{
                                            iconUrl = setFly(aircraftType);
                                        }
                                    }else if(_this.settingData.airvalue == 2){
                                        if(airType == 2){
                                            iconUrl = 'images/plane_small.png';
                                        }else {
                                            continue;
                                        }
                                    }else{
                                        if(airType == 1){
                                            iconUrl = setFly(aircraftType);
                                        }else{
                                            continue;
                                        }
                                    }
                                    iconSize = [19, 19];
                                    className= '';
                                }
                                divIhtml = "";
                            }
                            //加载标牌
                            if(_this.settingData.Scutcheon){
                                _this.renderScutcheon(res[i]);
                            }
                        
                            // 创建飞机图标 批量生成marker
                            flightMarker = _this.renderAirMaker(res[i].cat021Bean,iconUrl,iconSize,className)
                            
                        }
                        //重新设置选中的marker
                        if (isSelectFlight) {
                            _this.selectedflight = flightMarker;
                        }
                        _this.flightLayers.push(flightMarker);
                       
                    }else{
                        // console.log(height+">"+maxHeight);
                        
                        continue;
                    }
                }
    
                if (_this.flightScutcheonLayers.length > 0) {
                    _this.flightScutcheonLayersGroup = L.layerGroup(_this.flightScutcheonLayers);
                    _this.map.addLayer(_this.flightScutcheonLayersGroup);
                }
    
                //添加到地图
    
                _this.flightLayerGroup = L.layerGroup(_this.flightLayers);
                _this.map.addLayer(_this.flightLayerGroup);
    
                if(_this.flightTrackLayers.length > 0)
                {
                    _this.flightTrackLayersGroup = L.layerGroup(_this.flightTrackLayers);
                    _this.map.addLayer(_this.flightTrackLayersGroup);
                }

                _this.DataNum = 0;

            }else{
                if(_this.DataNum >= 60){
                    _this.$message({
                        message: '飞机数据加载出错，请及时联系后台管理人员',
                        type: 'error'
                    });
                }
                _this.DataNum += 1;
                // _this.getData();
            }
            
        },
    
        renderAlarmAirMarker(res,iconUrl,iconSize,className,alarm_type){
            //遇险飞机加载
            return L.marker([res.lat, res.log], {
                icon: new L.icon({
                    iconUrl: iconUrl,
                    iconSize: iconSize,
                    className: className
                }),
                rotationAngle: res.heading,
                rotationOrigin: "center",
                alt:res.targetAddress,
                alarm_type:alarm_type,
                types:2,
                airType:res.airType,
                aircraftType:res.aircraftType
            }).on('dblclick', this.flightMarkerDbClick).on('click', this.flightMarkerClick);
        },
        renderAirMaker(res,iconUrl,iconSize,className){
            // console.log(res);
            //正常飞机加载
            return L.marker([res.lat, res.log], {
                icon: new L.icon({
                    iconUrl: iconUrl,
                    iconSize: iconSize,
                    className: className
                }),
                rotationAngle: res.heading,
                rotationOrigin: "center",
                alt:res.targetAddress,
                alarm_type:"",
                types:1,
                airType:res.airType,
                aircraftType:res.aircraftType
            }).on('dblclick', this.flightMarkerDbClick).on('click', this.flightMarkerClick);
        },
        renderScutcheon(res) {
            //正常飞机标牌
            var _this = this;
            var zoom = _this.map.getZoom();
            var divIhtml = "";
            var classname = "";
            var isSJ = "";
            
            if(res.cat021Bean.verticalMotionIden == 1){
                isSJ = "↓"
            }else if(res.cat021Bean.verticalMotionIden == 0){
                isSJ = "↑"
            }
            //缩放比例小于9，不显示标牌
            if (zoom < 9 || !_this.ifShowScutcheon) return;

            if (zoom >= 9 && zoom < 10) {
                //显示简标
                if(res.cat021Bean.airType==1){
                    //通航
                    divIhtml = "<div><span>" + res.cat021Bean.freeText + "</span></div>";
                }else{
                    //民航
                    divIhtml = "<div><span>" + res.cat021Bean.targetIden + "</span></div>";
                }
                
                classname = 'class_icon_2'
            } else if (zoom >= 10) {
                //显示全标
                divIhtml = "<div><span>" + res.cat021Bean.targetAddress + "</span><br>";
                if(res.cat021Bean.airType==1){
                    //通航
                    divIhtml += "<span>" + res.cat021Bean.protocolType + "</span><br>";
                    divIhtml += "<span>" + res.cat021Bean.freeText + "</span><br>";
                    
                }else{
                    //民航
                    divIhtml += "<span>" + res.cat021Bean.targetIden + "</span><br>";
                }
                if(_this.settingData.unit == 1){
                    //英制
                    divIhtml += "<span>" + Math.round(res.cat021Bean.height * 100) / 100 + " "+isSJ+" "  + Math.round(res.cat021Bean.groundSpeed * 1000) + "</span><br>";
                    
                }else if(_this.settingData.unit == 2){
                    //公制
                    divIhtml += "<span>" + Math.round(res.cat021Bean.height * 0.3048 * 100) / 100 + " "+isSJ+" "  + Math.round(res.cat021Bean.groundSpeed *1852) + "</span><br>";
                }
                divIhtml += "<span>" + Math.round(res.cat021Bean.heading) + "°</span></div>";
                classname = 'class_icon_1'
            }

            var flightTipMarker = L.marker([res.cat021Bean.lat, res.cat021Bean.log], {
                icon: L.divIcon({
                    html: divIhtml,
                    className: classname
                })
            })
            _this.flightScutcheonLayers.push(flightTipMarker);
        },
        renderAlarmScutcheon(res,row) {
            //遇险飞机标牌
            var _this = this;
            var zoom = _this.map.getZoom();
            var divIhtml = "";
            var classname = "";
            var isSJ = "";
            if(res.cat021Bean.verticalMotionIden == 1){
                isSJ = "↓"
            }else if(res.cat021Bean.verticalMotionIden == 0){
                isSJ = "↑"
            }
            //缩放比例小于9，不显示标牌
            if (zoom < 9 || !_this.ifShowScutcheon) return;

            if (zoom >= 9 && zoom < 10) {
                //显示简标
                if(res.cat021Bean.airType==1){
                    //通航
                    divIhtml = "<div><span>" + res.cat021Bean.freeText + "</span></div>";
                }else{
                    //民航
                    divIhtml = "<div><span>" + res.cat021Bean.targetIden + "</span></div>";
                }
               
                classname = 'class_icon_2'
            } else if (zoom >= 10) {
                //显示全标
                divIhtml = "<div><span>" + res.cat021Bean.targetAddress + "</span><br>";
                if(res.cat021Bean.airType==1){
                    //通航
                    
                    divIhtml += "<span>" + res.cat021Bean.protocolType + "</span><br>";
                    divIhtml += "<span>" + res.cat021Bean.freeText + "</span><br>";
                }else{
                    //民航
                    divIhtml += "<span>" + res.cat021Bean.targetIden + "</span><br>";
                }
                if(_this.settingData.unit == 1){
                    //英制
                    divIhtml += "<span>" + Math.round(res.cat021Bean.height * 100) / 100 + " "+isSJ+" "  + Math.round(res.cat021Bean.groundSpeed * 1000) + "</span><br>";
                    
                }else if(_this.settingData.unit == 2){
                    //公制
                    divIhtml += "<span>" + Math.round(res.cat021Bean.height * 0.3048 * 100) / 100 + " "+isSJ+" "  + Math.round(res.cat021Bean.groundSpeed *1852) + "</span><br>";
                }
                divIhtml += "<span>" + Math.round(res.cat021Bean.heading) + "°</span><br>";
                divIhtml += "<span>" + row + "</span></div>";
                classname = 'class_icon_1'
            }

            var flightTipMarker = L.marker([res.cat021Bean.lat, res.cat021Bean.log], {
                icon: L.divIcon({
                    html: divIhtml,
                    className: classname
                })
            })
            _this.flightScutcheonLayers.push(flightTipMarker);
        },
        
        flightMarkerDbClick(e) {
            //双击遇险飞机
            //聚集选中的飞机
            this.map.setView(e.target.getLatLng(), 10);
            if(e.target.options.types ==1){
                if(e.target.options.airType == 1){
                    iconUrl = setOnFly(e.target.options.aircraftType);
                    
                }else{
                    iconUrl = 'images/plane_big_pitch.png'
                }
                e.target.setIcon(new L.icon({
                    iconUrl:iconUrl,
                    iconSize: [50, 50]
                }));
            }else{
                
                if(e.target.options.airType == 1){
                    iconUrl = setOnAlarm(e.target.options.aircraftType);
                   
                }else{
                    if(e.target.options.alarm_type.indexOf("M") == 0){
                        iconUrl='images/air/red-dashed-on.png';
                    }else{
                        iconUrl='images/air/aircraft-alarm-red-on.png';
                    }
                }
                e.target.setIcon(new L.icon({
                    iconUrl: iconUrl,
                    iconSize: [50, 50]
                }));
            }
            //更新选中图标
            // if(e.target.options.alarm_type.indexOf("M") == 0){
            //     e.target.setIcon(new L.icon({
            //         iconUrl: 'images/air/red-dashed-on.png',
            //         iconSize: [50, 50]
            //     }));
            // }else{
            //     e.target.setIcon(new L.icon({
            //         iconUrl: 'images/air/aircraft-alarm-red-on.png',
            //         iconSize: [50, 50]
            //     }));
            // }
            //存储选中飞机，用于数据刷新时，判断选中效果
            this.selectedflight = e.target;
            
        },
        flightMarkerClick(e) {
            //单击飞机
            var _this =this;
            var iconUrl;
            //清除上一次选中效果
            
            if (_this.selectedflight != null) {
                if(_this.selectFlyType ==1){
                    if(e.target.options.airType == 2){
                        iconUrl = 'images/plane_zhong.png';
                    }else{
                        iconUrl = setFly(e.target.options.aircraftType);
                        
                    }
                    _this.selectedflight.setIcon(new L.icon({
                        iconUrl: iconUrl,
                        iconSize: [38, 38],
                        className: "flightIcon_zhong"
                    }));
                }else{
                    
                    if(e.target.options.airType == 1){
                        iconUrl = setAlarm(e.target.options.aircraftType);
                        
                    }else{
                        if(e.target.options.alarm_type.indexOf("M") == 0){
                            iconUrl = 'images/air/red-dashed.png'
                        }else{
                            iconUrl = 'images/air/aircraft-alarm-red.png'
                        }
                    }
                    _this.selectedflight.setIcon(new L.icon({
                        iconUrl: iconUrl,
                        iconSize: [38, 38],
                    }));
                   
                }
                
                //判断选中是同一架飞机，则取消选中
                if (_this.selectedflight.options.alt == e.target.options.alt) {
                    _this.selectedflight = null;
                    _this.selectFlyType = e.target.options.types;
                    return;
                }
            }
            _this.selectFlyType = e.target.options.types;
            // console.log(e.target)
            //更新选中图标
            if(e.target.options.types ==1){
                if(e.target.options.airType == 1){
                    iconUrl = setOnFly(e.target.options.aircraftType);
                  
                }else{
                    iconUrl = 'images/plane_big_pitch.png'
                }
                e.target.setIcon(new L.icon({
                    iconUrl:iconUrl,
                    iconSize: [50, 50]
                }));
            }else{
                
                if(e.target.options.airType == 1){
                    iconUrl = setOnAlarm(e.target.options.aircraftType);
                }else{
                    if(e.target.options.alarm_type.indexOf("M") == 0){
                        iconUrl='images/air/red-dashed-on.png';
                    }else{
                        iconUrl='images/air/aircraft-alarm-red-on.png';
                    }
                }
                e.target.setIcon(new L.icon({
                    iconUrl: iconUrl,
                    iconSize: [50, 50]
                }));
            }
            
            //存储选中飞机，用于数据刷新时，判断选中效果
            _this.selectedflight = e.target;
            
            // 点击飞机弹出监控目标的飞机信息
            _this.isshowBg3 = !_this.isshowBg3; //从左展出第三级弹窗
            _this.ishideleftNav = true;
            _this.cursignalSource = "ADS-B";
            _this.curtargetAddress = _this.selectedflight.options.alt;
            _this.getQuxianmap();

            var dataObj = {  
                signalSource: _this.cursignalSource,
                targetAddress: _this.curtargetAddress,
                currentPage:0,
                pageSize:0
                
            };
            
            map_aircraftDetail(dataObj).then(function (response) {
                console.log(response);
                if (response.data.success) {
                    
                	
                    _this.aircraftInfo = response.data.aircraftInfo;
                } else {
                    _this.aircraftInfo = {};
                	_this.$message.error('未获取到相关信息！');
                }
                _this.selectLoad(_this.curtargetAddress);
            }).catch(function (error) {
                console.log(error);
            });
        },
        selectLoad(val){
            var _this = this;
            if(_this.resultVar != null){
                clearInterval(_this.resultVar)
            }
            
            _this.resultVar = setInterval(function(){
                map_selectLoad({targetAddress: val}).then(function (res) {
                    _this.resultCount = res.data.resultCount;
                })
            },5000);
        },
       
        ERChange (val){
            //情报---应急救援开关按钮
            var _this = this;
            _this.emergencyResources = val;
            if(_this.emergencyResources){
                _this.openEmergencyResources()
            }else{
                _this.closeEmergencyResources();
            }
        },
        openEmergencyResources () {
            //打开应急资源站
            //清除
            this.closeEmergencyResources()

            var self = this;
            var ERMaker,
                //ERRange,
                iconUrl,
                iconSize,
                //isSelectADSB,
                singleTip,
                alarmTipMarker
                divHtml="",
                zoomindex = this.map.getZoom();
                emergencyResources_selectAll({
                    page:1,
                    size:0
                }).then(function (res) {
                    if (res.status == 200) {
                        var json = res.data.emergencyResources
                        
                        for(var i=0;i<json.length;i++){

                            let lat = json[i].latitude,            //经度
                                log = json[i].longitude,           //纬度
                                emergencyName = json[i].emergency_name,    //名称
                                //id = json[i].id,                           //id
                                place = json[i].place_belonging,           //地点
                                emergencyType = json[i].emergency_type;    //类型
                                contactNumber = json[i].contact_number;

                            //判断是什么类型的资源图标
                            if(emergencyType == "医院"){
                               if (zoomindex >= 7 ) {
                                    iconUrl = 'images/air/hospital-orange.png';
                                    iconSize = [38, 38];
                                }else {
                                    iconUrl = 'images/air/hospital-orange-xiao.png';
                                    iconSize = [19, 19];
                                }
                            }else if(emergencyType == "公安"){
                                if (zoomindex >= 7) {
                                    iconUrl = 'images/air/police-orange.png';
                                    iconSize = [38, 38];
                                }else {
                                    iconUrl = 'images/air/police-orange-xiao.png';
                                    iconSize = [19, 19];
                                }
                            }else if(emergencyType == "消防"){
                                if (zoomindex >= 7) {
                                    iconUrl = 'images/air/fire-orange.png';
                                    iconSize = [38, 38];
                                }else {
                                    iconUrl = 'images/air/fire-orange-xiao.png';
                                    iconSize = [19, 19];
                                }
                            }else if(emergencyType == "救援"){
                                if (zoomindex >= 7) {
                                    iconUrl = 'images/air/sos-orange.png';
                                    iconSize = [38, 38];
                                }else {
                                    iconUrl = 'images/air/sos-orange-xiao.png';
                                    iconSize = [19, 19];
                                }
                            }

                            //鼠标移上去提示牌
                            singleTip = "<div class='single'>"+
                                            "<p>类型："+emergencyType+"</p>"+
                                            "<p>经度："+log.substring(0,log.indexOf(".") + 3)+"</p>"+
                                            "<p>纬度："+lat.substring(0,lat.indexOf(".") + 3)+"</p>"+
                                            "<p>联系电话："+contactNumber+"</p>"+
                                        "</div>";
                            if (zoomindex >= 9) {
                                divHtml = "<div class='single'>"+
                                "<span>"+emergencyName+"</span>"+
                                "</div>"
                            }
                            alarmTipMarker = L.marker([lat, log], {
                                icon: L.divIcon({
                                    html: divHtml,
                                    className:"adsb_class_icon"
                                })
                            })
                            self.alarmLayers.push(alarmTipMarker);
                            //创建应急资源图标
                            ERMaker = L.marker([lat, log], {
                                icon: new L.icon({
                                    iconUrl: iconUrl,
                                    iconSize: iconSize
                                }),
                                //id:id
                            }).bindPopup(singleTip).openPopup();
                            // bindTooltip(singleTip).openTooltip()
                            self.ERLayer.push(ERMaker);
                        }
                        if (self.alarmLayers.length > 0) {
                            self.alarmLayersGroup = L.layerGroup(self.alarmLayers);
                            self.map.addLayer(self.alarmLayersGroup);
                        }
                        //添加到地图上
                        self.ERLayerGroup = L.layerGroup(self.ERLayer);
                        self.map.addLayer(self.ERLayerGroup);
                    }
                }).catch(function (err) {
                    console.log(err)
                });

        },
        closeEmergencyResources (){
            //关闭or清除应急资源图标的方法
            if(this.ERLayer.length>0){
                this.ERLayer = [];
                this.ERLayerGroup.clearLayers();
            }
            if(this.alarmLayers.length>0){
                this.alarmLayers = [];
                this.alarmLayersGroup.clearLayers();
            }
        },
        isSelectADSB(row) {
           //打开飞行服务站的方法ads-b
            return this.selectedADSB != null && this.selectedADSB.options.id == row.id
        },
        flightChange (val){
            //情报--- 打开监视设施
            var _this = this
            _this.adsbValue = val;
            if(_this.adsbValue){
                _this.openFlight()
            }else{
                _this.closeFlight();
            }
        },
        openFlight () {
            //清除
            this.closeFlight();

            var self = this;
            var adsbMaker,
                adsbRange,
                iconUrl,
                iconSize,
                isSelectADSB,
                singleTip="",
                zoomindex = this.map.getZoom();
            system_groundstation_list({
                page:1,
                size:0
            }).then(function (res) {
                
                if (res.status == 200) {
                    var json = res.data.groundStationInfoList
                    
                    for(var i=0; i<json.length; i++){
                        isSelectADSB = self.isSelectADSB(json[i]);
                        let lat = json[i].latitude,            //wei'du
                            log = json[i].longitude,           //纬度
                            range = json[i].actionRange,        //作用范围半径
                            groundStationName = json[i].groundStationName,     //设备名称
                            id = json[i].id,                    //创建时间
                            state = json[i].state;                             //状态

                        //adsb图标根据地图尺寸缩放
                        
                        if(state == 1){
                            if(zoomindex>=10){
                                if(isSelectADSB){
                                    iconUrl = 'images/air/ADS-B-alarm-red.png';
                                    iconSize = [76, 76];
                                }else{
                                    iconUrl = 'images/air/ADS-B-big.png';
                                    iconSize = [76, 76];
                                }
                            }else if (zoomindex >= 7 && zoomindex < 10) {
                                if(isSelectADSB){
                                    iconUrl = 'images/air/ADS-B-alarm-red.png';
                                    iconSize = [57, 57];
                                }else{
                                    iconUrl = 'images/air/ADS-B-big.png';
                                    iconSize = [57, 57];
                                }
                            }else {
                                if(isSelectADSB){
                                    iconUrl = 'images/air/ADS-B-alarm-red.png';
                                    iconSize = [38, 38];
                                }else{
                                    iconUrl = 'images/air/ADS-B-big.png';
                                    iconSize = [38, 38];
                                } 
                            }
                        }else {
                            if(zoomindex>=10){
                                if(isSelectADSB){
                                    iconUrl = 'images/air/ADS-B-alarm-yellow-on.png';
                                    iconSize = [76, 76];
                                }else{
                                    iconUrl = 'images/air/ADS-B-alarm-yellow.png';
                                    iconSize = [76, 76];
                                }
                            }else if (zoomindex >= 7 && zoomindex < 10) {
                                if(isSelectADSB){
                                    iconUrl = 'images/air/ADS-B-alarm-yellow-on.png';
                                    iconSize = [57, 57];
                                }else{
                                    iconUrl = 'images/air/ADS-B-alarm-yellow.png';
                                    iconSize = [57, 57];
                                }
                            }else {
                                if(isSelectADSB){
                                    iconUrl = 'images/air/ADS-B-alarm-yellow-on.png';
                                    iconSize = [38, 38];
                                }else{
                                    iconUrl = 'images/air/ADS-B-alarm-yellow.png';
                                    iconSize = [38, 38];
                                } 
                            }
                        }
                        //鼠标移上去提示牌
                        if(zoomindex >=9){
                            singleTip = "<div class='single'>"+
                                        "<p>"+groundStationName+"</p>"+
                                    "</div>";
                        }
                        

                        var ADSBTipMarker = L.marker([lat, log], {
                            icon: L.divIcon({
                                html: singleTip,
                                className:"adsb_class_icon"
                            })
                        })
                        self.ADSBLayers.push(ADSBTipMarker);
            
                        //创建飞行服务站图标adsb
                        adsbMaker = L.marker([lat, log], {
                            icon: new L.icon({
                                iconUrl: iconUrl,
                                iconSize: iconSize
                            }),
                            id:id,
                            state: state
                        }).on('click', self.adsbMarkerClick);
                        //.bindPopup(singleTip).openPopup();
                        
                        
                        //创建飞行服务站范围-给服务站画圆
                        adsbRange = L.circle([lat, log],{
                            color: 'red',
                            fillColor: '#fff',
                            fillOpacity: 0.000001,
                            dashArray: "5",
                            radius: range*1000
                        })

                        //重新设置选中的服务站adsb
                        if (isSelectADSB) {
                            self.selectedADSB = adsbMaker;
                            self.adsbLayer.push(adsbRange);
                        }
                        self.adsbLayer.push(adsbMaker);
                       
                    }
                    if (self.ADSBLayers.length > 0) {
                        self.ADSBLayersGroup = L.layerGroup(self.ADSBLayers);
                        self.map.addLayer(self.ADSBLayersGroup);
                    }
                    //添加到地图上
                    self.adsbLayerGroup = L.layerGroup(self.adsbLayer);
                    self.map.addLayer(self.adsbLayerGroup);
                }
            }).catch(function (err) {
                console.log(err)
            });
        },
        closeFlight (){
            //关闭or清除飞行服务站的方法ads-b
            if(this.adsbLayer.length>0){
                this.adsbLayer = [];
                this.adsbLayerGroup.clearLayers();
            }
            if(this.ADSBLayers.length>0){
                this.ADSBLayers = [];
                this.ADSBLayersGroup.clearLayers();
            }
        },
        adsbMarkerClick(e) {
            //单击ADS-B信号台
            //清除上一次选中效果
            var _this = this;
            
            
            if (_this.selectedADSB != null) {
                
                //判断什么状态显示什么颜色的图标
                if(_this.selectedADSB.options.state == 1){
                    if(_this.zoomIndex >= 10){
                        _this.selectedADSB.setIcon(new L.icon({
                            iconUrl: 'images/air/ADS-B-big.png',
                            iconSize: [76, 76]
                        }));
                    }else if(_this.zoomIndex >=7 && _this.zoomIndex <10){
                        _this.selectedADSB.setIcon(new L.icon({
                            iconUrl: 'images/air/ADS-B-big.png',
                            iconSize: [57, 57]
                        }));
                    }else{
                        _this.selectedADSB.setIcon(new L.icon({
                            iconUrl: 'images/air/ADS-B-big.png',
                            iconSize: [38, 38]
                        }));
                    }
                   
                }else {
                    if(_this.zoomIndex >= 10){
                        _this.selectedADSB.setIcon(new L.icon({
                            iconUrl: 'images/air/ADS-B-alarm-yellow.png',
                            iconSize: [76, 76]
                        }));
                    }else if(_this.zoomIndex >=7 && _this.zoomIndex <10){
                        _this.selectedADSB.setIcon(new L.icon({
                            iconUrl: 'images/air/ADS-B-alarm-yellow.png',
                            iconSize: [57, 57]
                        }));
                    }else{
                        _this.selectedADSB.setIcon(new L.icon({
                            iconUrl: 'images/air/ADS-B-alarm-yellow.png',
                            iconSize: [38, 38]
                        }));
                    }
                    
                }
                //判断选中是同一个服务站，则取消选中
                if (_this.selectedADSB.options.id == e.target.options.id) {
                    _this.selectedADSB = null;
                    
                    _this.openFlight();
                    return;
                }
            }

            
            _this.openFlight();
            //根据状态更新选中图标
            if(e.target.options.state == 1){
                if(_this.zoomIndex >= 10){
                    e.target.setIcon(new L.icon({
                        iconUrl: 'images/air/ADS-B-alarm-red.png',
                        iconSize: [76, 76]
                    })); 
                }else if(_this.zoomIndex >= 7 && _this.zoomIndex <10){
                    e.target.setIcon(new L.icon({
                        iconUrl: 'images/air/ADS-B-alarm-red.png',
                        iconSize: [57, 57]
                    })); 
                }else{
                    e.target.setIcon(new L.icon({
                        iconUrl: 'images/air/ADS-B-alarm-red.png',
                        iconSize: [38, 38]
                    })); 
                }
                
            }else {
                if(_this.zoomIndex >= 10){
                    e.target.setIcon(new L.icon({
                        iconUrl: 'images/air/ADS-B-alarm-yellow-on.png',
                        iconSize: [76, 76]
                    }));
                }else if(_this.zoomIndex >= 7 && _this.zoomIndex <10){
                    e.target.setIcon(new L.icon({
                        iconUrl: 'images/air/ADS-B-alarm-yellow-on.png',
                        iconSize: [57, 57]
                    }));
                }else {
                    e.target.setIcon(new L.icon({
                        iconUrl: 'images/air/ADS-B-alarm-yellow-on.png',
                        iconSize: [38, 38]
                    }));
                }
                
            }
            //存储选中飞机，用于数据刷新时，判断选中效果
            _this.selectedADSB = e.target;
           
        },
        isSelectVHF(row) {

             //判断是否选中VHF电台
            // console.log(row)
            // console.log(this.selectedVHF)
            return this.selectedVHF != null && this.selectedVHF.options.id == row.id
        },
        VHFChange (val){
            // console.log(row);
            //情报---打开通讯设施的方法VHF电台
            this.vhfValue = val;
            if(this.vhfValue){
                this.openVHFRadio()
            }else{
                this.closeVHFRadio();
            }
           
        },
        openVHFRadio () {
            //清除
            this.closeVHFRadio();
            
            var self = this;
            var VHFMaker,
                singleTip="",
                VHFRange,
                iconUrl,
                iconSize,
                isSelectVHF,
                zoomindex = this.map.getZoom();
            vhfRadioStaitonManager_selectAll({
                page:1,
                size:10
            }).then(function (res) {
                if (res.status == 200) {
                    var json = res.data.vhfRadioStationManagerPage.records
                    
                    for(var i=0; i<json.length; i++){
                        isSelectVHF = self.isSelectVHF(json[i]);
                        let lat = json[i].latitude,            //经度
                            log = json[i].longitude,           //纬度
                            range = json[i].actionRange,        //作用范围半径
                            equipmentName = json[i].equipmentName,  //名称
                            id = json[i].id,
                            frequency = json[i].frequency;        //id
                            //state = json[i].state;                  //状态

                        //根据状态来判断显示什么颜色的图标
                            //VHF图标根据地图尺寸缩放
                            if(zoomindex>=10){
                               
                                if(isSelectVHF){
                                    iconUrl = 'images/air/WHF-alarm-red.png';
                                    iconSize = [76, 76];
                                }else{
                                    iconUrl = 'images/air/WHF-big.png';
                                    iconSize = [76, 76];
                                }
                            }else if (zoomindex >= 7 && zoomindex < 10) {
                                if(isSelectVHF){
                                    iconUrl = 'images/air/WHF-alarm-red.png';
                                    iconSize = [57, 57];
                                }else{
                                    iconUrl = 'images/air/WHF-big.png';
                                    iconSize = [57, 57];
                                }
                            }else {
                                if(isSelectVHF){
                                    iconUrl = 'images/air/WHF-alarm-red.png';
                                    iconSize = [38, 38];
                                }else{
                                    iconUrl = 'images/air/WHF-big.png';
                                    iconSize = [38, 38];
                                } 
                            }
                        
                        //鼠标移上去提示牌
                        if(zoomindex >= 9){
                            singleTip = "<div>"+
                                        "<p>"+frequency+"</p>"+
                                    "</div>";
                        }
                        
                        var VHFTipMarker = L.marker([lat, log], {
                            icon: L.divIcon({
                                html: singleTip,
                                className:"vhf_class_icon"
                            })
                        })
                        self.VHFLayers.push(VHFTipMarker);

                        //创建飞行服务站图标vhf
                       
                        VHFMaker = L.marker([lat, log], {
                            icon: new L.icon({
                                iconUrl: iconUrl,
                                iconSize: iconSize
                            }),
                            id:id,
                            range:range,
                            lat:lat,
                            log:log
                            //state:state
                        }).on('click', self.VHFMarkerClick);
                        //.bindPopup(singleTip).openPopup();
                        
                        //创建电台通讯设施范围-给电台画圆
                        VHFRange = L.circle([lat, log],{
                            color: 'red',
                            fillColor: '#fff',
                            fillOpacity: 0.000001,
                            dashArray: "5",
                            radius: (range*1000)
                        })

                        //重新设置选中的服务站adsb
                        if (isSelectVHF) {
                            self.selectedVHF = VHFMaker;
                            self.VHFcirLayer.push(VHFRange);
                        }
                        self.VHFLayer.push(VHFMaker);
                        
                        // self.VHFLayer.push(VHFRange);
                    }
                    if (self.VHFLayers.length > 0) {
                        self.VHFLayersGroup = L.layerGroup(self.VHFLayers);
                        self.map.addLayer(self.VHFLayersGroup);
                    }
                    self.VHFcirLayerGroup = L.layerGroup(self.VHFcirLayer);
                    self.map.addLayer(self.VHFcirLayerGroup);
                    //添加到地图上
                    self.VHFLayerGroup = L.layerGroup(self.VHFLayer);
                    self.map.addLayer(self.VHFLayerGroup);
                }
            }).catch(function (err) {
                console.log(err)
            });
            
        },
       
        closeVHFRadio (){
            if(this.VHFLayers.length>0){
                this.VHFLayers = [];
                this.VHFLayersGroup.clearLayers();
            }
            if(this.VHFLayer.length>0){
                this.VHFLayer = [];
                this.VHFLayerGroup.clearLayers();
            }
            if(this.VHFcirLayer.length>0){
                this.VHFcirLayer = [];
                this.VHFcirLayerGroup.clearLayers();
            }
        },
        VHFMarkerClick(e) {
            //单击VHF信号塔
            var _this = this;
            //清除上一次选中效果
           
            
            if (_this.selectedVHF != null) {
                
                //根据状态判断显示的图标颜色
                if(_this.zoomIndex >= 10){
                    _this.selectedVHF.setIcon(new L.icon({
                        iconUrl: 'images/air/WHF-big.png',
                        iconSize: [76, 76]
                    }));
                }else if(_this.zoomIndex >=7 && _this.zoomIndex <10){
                    _this.selectedVHF.setIcon(new L.icon({
                        iconUrl: 'images/air/WHF-big.png',
                        iconSize: [57, 57]
                    }));
                }else{
                    _this.selectedVHF.setIcon(new L.icon({
                        iconUrl: 'images/air/WHF-big.png',
                        iconSize: [38, 38]
                    }));
                }
                
                
                //判断选中是同一个通讯设施，则取消选中
                if (_this.selectedVHF.options.id == e.target.options.id) {
                    _this.selectedVHF = null;
                    _this.openVHFRadio();
                    return;
                }
                
                
            }
           
            _this.openVHFRadio();
            //根据状态来更新选中图标
            //更新选中图标
            if(_this.zoomIndex >= 10){
                e.target.setIcon(new L.icon({
                    iconUrl: 'images/air/WHF-alarm-red.png',
                    iconSize: [76, 76]
                }));
            }else if(_this.zoomIndex >= 7 && _this.zoomIndex <10){
                e.target.setIcon(new L.icon({
                    iconUrl: 'images/air/WHF-alarm-red.png',
                    iconSize: [57, 57]
                }));
            }else {
                e.target.setIcon(new L.icon({
                    iconUrl: 'images/air/WHF-alarm-red.png',
                    iconSize: [38, 38]
                }));
            }
            
            //存储选中飞机，用于数据刷新时，判断选中效果
            _this.selectedVHF = e.target;
        },
        
        enroteChange(val){
            //情报--航路航线
            var _this = this;
            _this.enroteValue = val;           
            if(_this.enroteLayer !=null){
                _this.enroteLayer.remove();
            }
            if(_this.enroteValue){
                _this.enroteLayer = L.supermap.tiledMapLayer("http://123.206.185.152:8090/iserver/services/map-new424/rest/maps/enroute", {
                transparent: true,
                    opacity: 0.6
                }).addTo(_this.map);
            }
            
        },
        airportChange(val){
            //情报--机场
            var _this = this;
            _this.airportValue = val;
            if(_this.airportLayer !=null){
                _this.airportLayer.remove();
            }
            if(_this.airportValue){
                _this.airportLayer = L.supermap.tiledMapLayer("http://123.206.185.152:8090/iserver/services/map-new424/rest/maps/airport", {
                transparent: true,
                    opacity: 0.6
                }).addTo(_this.map);
            }
            
        },
        ctrlairspaceChange(val){
            //情报--管制空域
            var _this = this;
            _this.ctrlairspaceValue = val;
            if(_this.ctrlairspaceLayer !=null){
                _this.ctrlairspaceLayer.remove();
            }
            if(_this.ctrlairspaceValue){
                _this.ctrlairspaceLayer = L.supermap.tiledMapLayer("http://123.206.185.152:8090/iserver/services/map-new424/rest/maps/ctrAirspace", {
                transparent: true,
                    opacity: 0.6
                }).addTo(_this.map);
            }
            
        },
        restairspaceChange(val){
            //情报--限制空域
            var _this = this;
            _this.restairspaceValue = val;
            if(_this.restairspaceLayer !=null){
                _this.restairspaceLayer.remove();
            }
            if(_this.restairspaceValue){
                _this.restairspaceLayer = L.supermap.tiledMapLayer("http://123.206.185.152:8090/iserver/services/map-new424/rest/maps/restAirspace", {
                transparent: true,
                    opacity: 0.6
                }).addTo(_this.map);
            }            
        },
        handleOpen(key, keyPath) {
            // 左侧导航栏打开
            var self = this;
            switch (key) {
                case '1':
                    self.getSignallist();
                    break;
                case '2':
                    self.getProcesslist();
                    break;
                case '3':
                    self.getAlarmlist();
                    break;
                default:
                    break;
            }

        },
        handleClose(key, keyPath) {
            // 左侧导航栏关闭
           
            if(this.flightGeoLayerGroup != null){
                this.flightGeoLayerGroup.clearLayers();
                this.flightGeoLayers = [];
            }
            clearInterval(this.clock_getSignallist);
            clearInterval(this.clock_getProcessNum);
            clearInterval(this.clock_getAlarmNum);
        },
        getSignallist: function() {
            // 监控目标列表
            var self = this;
            map_signalSourceCount({}).then(function(response) { 
                if(response.status == 200) {
                    if(response.data.signalSourceCountInfo != null){
                        self.signalData = response.data.signalSourceCountInfo;
                    }
                }
            })
            .catch(function(error) {
                console.log(error);
            });
        },
        getProcesslist() {
            // 飞机进程列表
            
            //预计起飞时间,预计降落时间，实际起飞时间，实际降落时间
            var self = this;
            flyProcess_selectAll({
                istoday:"1",
                page:1,
                size:0
            }).then(function (res) {
                // console.log(res);
                if (res.status == 200) {
                //    res.data.flyProcesslist.length
                    for(var i =0;i<res.data.flyProcesslist.length;i++){

                        if(res.data.flyProcesslist[i].isProcessOpacity == 0){
                            res.data.flyProcesslist[i].isBgOpacity = false;//飞行进程数据背景透明图显示隐藏
                            
                        }else{
                            res.data.flyProcesslist[i].isBgOpacity = true;//行进程数据背景透明图显示隐藏
                            
                        }
                        res.data.flyProcesslist[i].isTime = false;//显示时间段
                        
                        self.timeLines(res.data.flyProcesslist[i]);
                    }
                    self.flightData = res.data.flyProcesslist;
                   
                }
            }).catch(function (err) {
                console.log(err)
            });
        },
        getAlarmlist() {
            //告警记录列表
            var self = this;
            alarmRecord_selectAll({
                id:""
            }).then(function (res) {
                
                if (res.status == 200) {
                    if(res.data.alarmRecord != null){
                        for(var i =0;i<res.data.alarmRecord.length;i++){
                            if(res.data.alarmRecord[i].isRedAlarm == 0){
                                res.data.alarmRecord[i].isRedAlarmBool = false;//告警记录红色告警图标显示隐藏
                            }else{
                                res.data.alarmRecord[i].isRedAlarmBool = true;//告警记录红色告警图标显示隐藏
                            }
                            
                        }
                        // console.log(res.data)
                        self.alarmData = res.data.alarmRecord;
                        self.AlarmNum = res.data.alarmRecord.length;
                    }
                    
                }
            }).catch(function (err) {
                console.log(err)
            });
        },
        dblAlarmInfo(row, event){
            var self = this;
            self.AlarmListOpacitys =!self.AlarmListOpacitys;
            //告警详情记录
            if(self.AlarmListOpacitys){
                alarmRecord_selectAll({
                    id:row.id
                }).then(function (res) {
                    if (res.status == 200) {
                        if(res.data.alarmRecord != null){
                            self.AlarmDetailsData = res.data.alarmRecord[0];
                        }
                    }
                }).catch(function (err) {
                    console.log(err)
                });
            }
        },
        openRescueReport(row){
            //打开救援报告
            var _this =this;
            // console.log(row.alarm_type.indexOf("M"))
            if(row.alarm_type.indexOf("M") == 0){
                //告警类型首字母是 M 的，才能打开救援报告
                _this.RescueReportOpacitys = !_this.RescueReportOpacitys;
                if(_this.RescueReportOpacitys){
                    rescueReport_selectAll({
                        alarm_type:row.alarm_type
                    }).then(function (res) {
                        
                        if (res.status == 200) {
                            var China = L.supermap.tiledMapLayer('http://123.206.185.152:8090/iserver/services/map-new424/rest/maps/image').addTo(_this.AlarmMaps);
                            _this.RescueReportData = res.data.rescueReport[0];
                            _this.RescueReportData.position = "[经度:"+res.data.rescueReport[0].last_position_lat+"纬度:"+res.data.rescueReport[0].last_position_log+"]";
                            //预测轨迹数组
                            _this.RescueReportData.predictingTrajectory = [
                                [29.668493015610223, 106.7010945558548],
                                [29.718493015610223, 106.7510945558548],
                                [29.768493015610223, 106.8010945558548],
                                [29.818493015610223, 106.8510945558548],
                                [29.868493015610223, 106.9010945558548]];
                            //历史轨迹
                            _this.RescueReportData.historyTrajectory = [
                                [29.618493015610223, 106.6510945558548],
                                [29.568493015610223, 106.6510945558548],
                                [29.518493015610223, 106.6510945558548],
                                [29.468493015610223, 106.6510945558548],
                                [29.418493015610223, 106.6510945558548]];
                            
                            var HT = _this.RescueReportData.historyTrajectory;
                            if(_this.historyTrajectoryLayer != "")
                            {
                                _this.historyTrajectoryLayer = ""
                            }
                            
                            _this.historyTrajectoryLayer = L.polyline(HT, {color: '#0080FF'})
                            _this.AlarmMaps.addLayer(_this.historyTrajectoryLayer);
                           
                            
                            _this.historyTrajectoryLastPoint = L.circle([HT[0][0],HT[0][1]],{
                                color: 'red',
                                fillColor: '#0080FF',
                                fillOpacity: 0.000001,
                                dashArray: "5",
                                radius: 0.5
                            })
                            _this.AlarmMaps.addLayer(_this.historyTrajectoryLastPoint);
                            //-----------------------------------------
                            var PT = _this.RescueReportData.predictingTrajectory;
                            if(_this.predictingTrajectoryLayers.length > 0)
                            {
                                _this.predictingTrajectoryLayers = [];
                                _this.predictingTrajectoryGroup.clearLayers();
                            }
                            for(var j = 0 ; j< PT.length; j++)
                            {
                                _this.predictingTrajectoryLayers.push(
                                    L.circleMarker([PT[j][0],PT[j][1]], {
                                        color: '#0080FF',
                                        fillColor: '#0080FF',
                                        radius: 0.5,
                                        fillOpacity: 1
                                    }) 
                                )
                            }
                            if(_this.predictingTrajectoryLayers.length > 0)
                            {
                                _this.predictingTrajectoryGroup = L.layerGroup(_this.predictingTrajectoryLayers);
                                _this.AlarmMaps.addLayer(_this.predictingTrajectoryGroup);
                            }
                        }
                    }).catch(function (err) {
                        console.log(err)
                    });
                }
            }
        },
        closeRescueReport(){
            var _this =this;
            if(_this.RescueReportOpacitys)
            _this.RescueReportOpacitys =false;
        },
        closeAlarmSound(e,row){
            //关闭警报声音
            var _this = this;
            row.row.isRedAlarmBool = !row.row.isRedAlarmBool;
            
            // 播放音乐
            var videos = document.getElementById("gjvideo"+row.$index);
            
            var isRedAlarm = 0;
            if(row.row.isRedAlarmBool){
                isRedAlarm = 1;
                videos.play();
            }else{
                videos.pause();
            }
            alarmRecord_update({
                "a":{
                    "id":row.row.id,
                    "isRedAlarm":isRedAlarm
                }
            }).then(function(res) {
                // console.log(res)
            })
            _this.isVoice = !_this.isVoice;
        },
        setAlarmCenter(row){
            // console.log(row.source_type,row.alarm_source_number)
            var _this = this;
            map_signalSourceList({
                "signalSource": row.source_type,
                "targetAddress": row.alarm_source_number,
                "currentPage":1,
                "pageSize":10
            }).then(function(res){
                if(res.data.signalSourceCountInfo.cat021Bean.length > 0){
                    let lat = res.data.signalSourceCountInfo.cat021Bean[0].lat;
                    let log = res.data.signalSourceCountInfo.cat021Bean[0].log;
                    
                    _this.map.setView([lat, log], 10)
                }else{
                    _this.map.setView(JSON.parse(_this.userInfo.pointsDecimal.replace(/""/ig,"")), 10)
                }
                
            }).catch(function(err){
                console.log(err);    
            })
        },
        setCenter(row) {
            // 监控目标 - 二级菜单 - 飞机定位
            
            this.map.setView([row.lat, row.log], 10)
        },
        clickAtt(row){
            //监控目标 - 二级菜单 - 飞机关注
            console.log(row.isAttention);
            var _this = this;
            if(row.isAttention == 'no'){
                //飞机还未关注过
               
                insertSecAttention(_this,row);
            }else{
                //飞机已经关注过
                
                delSecAttention(_this,row.targetAddress);
                
            }
            
        },
        	//      by fuxin 9-27 s
        clickInfo(row, event, column) {
            
            if(row.count > 0){
                // 监控目标 - 点击选中数据
                this.infosOpacitys = !this.infosOpacitys
                if(!this.infosOpacitys) {
                    this.isshowBg3 = false;
                }
                this.jkmbSecondlist.curPage = 1;
                this.curRowjkmbFirst = row;
                this.getjkmbSecondlist()
            }else{
                this.$message.error(row.signalSource+'没有数据');
            }
            
		},
		getjkmbSecondlist: function() {
            // 监控目标 - 二级菜单弹出框
			var self = this;
            var curRow = self.curRowjkmbFirst;
            
            map_signalSourceList({
                signalSource: curRow.signalSource,
                targetAddress: self.searchAdress,
                currentPage: self.jkmbSecondlist.curPage,
                pageSize: 5
            }).then(function(response) {
					if(response.status == 200) {
						self.infosData = response.data.signalSourceCountInfo.cat021Bean;
                        // self.jkmbSecondlist.totalPage = parseInt(response.data.signalSourceCountInfo.count/5);
                        self.jkmbSecondlist.totalPage = Math.ceil(response.data.signalSourceCountInfo.count/5);
						self.jkmbSecondlist.totalNum = response.data.signalSourceCountInfo.count;
                        self.cursignalSource = curRow.signalSource;
                        // console.log(self.infosData);
                    }
                    
				})
				.catch(function(error) {
					console.log(error);
				});
        },
        clickNewsignal(){
            // 飞行进程 - 新增按钮
            var _this = this;
            _this.addFlightOpacitys = !this.addFlightOpacitys;
            _this.addFlyProcessInfo = [];
            if(_this.addFlightOpacitys){
                fly_plan_selectAll({
                    executorDate:"2018-10-10",
                    page: 1,
                    size: 0
                }).then(function (res) {
                    if (res.status == 200) {
                       _this.flyCodes = res.data.page.records;
                    }
                })
                .catch(function (err) {
                    console.log(err);
                });
            }
            
        },
        ceshi(command){
            // 飞行进程 - 新增页面 - 飞行进程编号 选择
            var _this = this;
            fly_plan_selectAll({
                flyPlanCode:command,
                page: 1,
                size: 0
            }).then(function (res) {
                if (res.status == 200) {
                    // _this.flyCodes = res.data.page.records;
                    var addJson = res.data.page.records[0];
                    
                    _this.addFlyProcessInfo.flyRule = addJson.flyRule;//飞行规则
                    _this.addFlyProcessInfo.estimatedTakeoffTimeStr = addJson.executorDate + " " + _this.timeHMS(addJson.planFlyDate);//预计起落时间
                    _this.addFlyProcessInfo.estimatedLandingTimeStr = addJson.executorDate + " " + _this.timeHMS(addJson.planJlDate);//预计降落时间
                    _this.addFlyProcessInfo.projectedShelf = addJson.planCount;//预计起落架次

                    _this.addFlyProcessInfo.flyAircraft = addJson.flyAircraft;//航空器注册号

                    _this.addFlyProcessInfo.actualTakeoffTimeStr = addJson.executorDate + " " + _this.timeHMS(addJson.actualDepTime);//实际起落时间
                    _this.addFlyProcessInfo.actualLandingTimeStr = addJson.executorDate + " " + _this.timeHMS(addJson.actualArrTime);//实际降落时间
                    _this.addFlyProcessInfo.actualLandingGear = addJson.actualSortie;//实际起落架次

                    _this.addFlyProcessInfo.contacts = addJson.planeAptainName;//联系人
                    _this.addFlyProcessInfo.fssId = addJson.fssId;//服务站关联计划ID
                    //查询组织结构
                    structure_selectDetail({code:addJson.fssId}).then(function (res) {
                        if(res.data.structure.length != 0){
                            _this.addFlyProcessInfo.initServerStation = res.data.structure[0].name;//初始服务站
                            _this.addFlyProcessInfo.currentServerStation = res.data.structure[0].name;//当前服务站
                        }else{
                            _this.addFlyProcessInfo.initServerStation = "";
                            _this.addFlyProcessInfo.currentServerStation = "";
                        }
                        
                    })
                }
            })
            .catch(function (err) {
                console.log(err);
            });
        },
        insertStateRecord(){
            // 飞行进程 - 新增页面 - 保存
            var _this =this;
            flyProcess_insertFlyProcess({
                "flyPlanCode":_this.addFlyProcessInfo.flyPlanCode,
                "flyProcess":{
                    "processState": _this.addFlyProcessInfo.processState,
                    "aircraftNumber": _this.addFlyProcessInfo.aircraftNumber,
                    "actualLandingGear": _this.addFlyProcessInfo.actualLandingGear,
                    "actualLandingTimeStr": _this.addFlyProcessInfo.actualLandingTimeStr,
                    "actualTakeoffTimeStr": _this.addFlyProcessInfo.actualTakeoffTimeStr,

                    "flyRule": _this.addFlyProcessInfo.flyRule,                
                    "estimatedLandingTimeStr": _this.addFlyProcessInfo.estimatedLandingTimeStr,
                    "estimatedTakeoffTimeStr": _this.addFlyProcessInfo.estimatedTakeoffTimeStr,
                    "projectedShelf": _this.addFlyProcessInfo.projectedShelf,

                    "currentServerStation": _this.addFlyProcessInfo.fssId,
                    "initServerStation": _this.addFlyProcessInfo.fssId,
                    "contacts": _this.addFlyProcessInfo.contacts
                }
            }).then(function(res){
                // console.log(res);
                _this.addFlightOpacitys = false;
            }).catch(function(err){
                console.log(err);    
            })
        },
        clickFlyInfos(row){
            // 进程服务 - 飞行详情进程 展示按钮
            this.flightOpacitys = !this.flightOpacitys
            if (this.flightOpacitys) {
                this.code = row.id;
                
                var self = this;
                // 飞行进程详情数据接口
                self.postSelectDetail(row.id)
                // 报告记录接口
                self.postRecord(row.id)
                // 状态记录接口
                self.postState(row.id)
            }
        },
        closeFlyInfos(){
            this.flightOpacitys = !this.flightOpacitys
        },
        clickFlyView(row){
            console.log(row);
            // 进程服务 - 飞行区域预览按钮
            var self = this;
            if(self.flightGeoLayerGroup != null){
                self.flightGeoLayerGroup.clearLayers();
                self.flightGeoLayers = [];
            }
            flyProcess_selectFlyPlan({
                flyPlanCode: row
            }).then(function (res) {
                console.log(res);
                if(res.data.flyPlans!=null){
                    self.flyPlansArr = res.data.flyPlans;
                    var log = res.data.flyPlans[0].log;
                    var lat = res.data.flyPlans[0].lat;
                    self.map.setView([lat,log], 10);
                    //飞行计划区域
                    self.renderGeoJsonGroup();
                }
            })
            .catch(function (err) {
                console.log(err);
            });
        },
        renderGeoJsonGroup(){
            // 进程服务 - 飞行区域
            var geoJson={},radius,flightPlan,myStyle = {
                "color": "#062e4d",
                "weight": 3,
                "opacity": 0.65
            }; 
           
            
            for(var i = 0 ; i < this.flyPlansArr.length ; i++){
                geoJson = this.flyPlansArr[i].geojson;
                
                var strA = JSON.stringify(geoJson);
                var strB = strA.replace(/geometrysNew/, "geometry");
                var strC = strB.replace(/geometrys/ig,"geometry");

                var jsonD = JSON.parse(strC);
                radius = this.flyPlansArr[i].radius;
                
                if(radius == ""){
                    flightPlan = L.geoJSON(jsonD, {
                        style: myStyle,
                        pointToLayer:function(geoJsonPoint, latlng){
                            return L.marker(latlng,{
                                icon: new L.icon({
                                    iconUrl: 'images/map_postion.png',
                                    iconSize:[19,19]
                                    // classname:'MarkerIconSize'
                                })
                            });
                        }
                    });
                }else{
                    //绘制圆
                    var lat = this.flyPlansArr[i].lat;
                    var log = this.flyPlansArr[i].log;
                    flightPlan = L.circle([lat, log],{
                        "color": "#062e4d",
                        "weight": 3,
                        "opacity": 0.65,
                        fillColor: '#062e4d',
                        fillOpacity: 0.2,
                        radius: radius
                    })
                }
                
                // this.map.addLayer(flightPlan);
                this.flightGeoLayers.push(flightPlan);
            }
            
            this.flightGeoLayerGroup = L.layerGroup(this.flightGeoLayers);
            this.map.addLayer(this.flightGeoLayerGroup);
        },
        closeFlightBriefing(){
            // 关闭飞行进程
            var _this = this;
            _this.FlightBriefingOpacitys = !_this.FlightBriefingOpacitys;
        },
        openFlightBriefing(row){
            let AircraftNumber = row.aircraftNumber;
            //进程服务 - 飞行简报
            var _this = this;
            if(row.processState == 21 || row.processState == 22){
                _this.FlightBriefingOpacitys = !_this.FlightBriefingOpacitys;
                if(_this.FlightBriefingOpacitys){
                    flyBriefing_selectAll({
                        "aircraft_number": row.aircraftNumber,
                    }).then(function (res) {
                        console.log(res);
                        if (res.status == 200) {
                            
                            var China = L.supermap.tiledMapLayer('http://support.supermap.com.cn:8090//iserver/services/map-china400/rest/maps/China_4326').addTo(_this.rightMaps);
                            
                            if(res.data.flyBriefing.length>0){
                                _this.FlightBriefingInfo = res.data.flyBriefing[0];
                            }
                            
                            if(_this.flightGeoLayer != null){
                        
                                _this.flightGeoLayer.clearLayers();
                                _this.flightGeoLayer = null
                            }
                            _this.renderGeoJson(res.data.geoJsonAirspace);
                        }
                    })
                    .catch(function (err) {
                        console.log(err);
                    });
                }
               
            }else {
                this.$alert('飞行进程结束才能打开', '提示', {
                    confirmButtonText: '确定',
                    callback: action => {
                        
                    }
                });
            }
            
        },
        renderGeoJson(geoJSON) {
            var strA = JSON.stringify(geoJSON);
            var strB = strA.replace(/geometrys/ig, "geometry");

            var jsonD = JSON.parse(strB);
            var myStyle = {
                "color": "#062e4d",
                "weight": 3,
                "opacity": 0.65
            }; 
            this.flightGeoLayer = L.geoJSON(jsonD, {
                style: myStyle,
                pointToLayer:function(geoJsonPoint, latlng){
                    return L.marker(latlng,{
                        icon: new L.icon({
                            iconUrl: 'images/map_postion.png',
                            iconSize:[19,19]
                        })
                    });
                }
            });
            // this.map.setView(e.target.getLatLng(), 10);
            this.rightMaps.addLayer(this.flightGeoLayer);
        },
        postSelectDetail(id){
            // 飞行进程详情数据接口
            var _this = this;
            flyProcess_selectDetail({
                id: id
            }).then(function (res) {
                if (res.status == 200) {
                    _this.flyProcessInfo = res.data.flyProcess;
                    _this.StateRecord = {
                        currentState: res.data.flyProcess.processState,
                    };
                    // 航空器注册号
                    _this.getRegistrationNumber(res.data.flyProcess.flyPlanCode)
                }
            })
            .catch(function (err) {
                console.log(err);
            });
        },
        getRegistrationNumber(flycode){
            // 航空器注册号
            var _this = this;
            fly_plan_selectAircraftByCode({
                flyPlanCode: flycode
            }).then(function(res){
                _this.RegistrationNumbers = res.data.flyairCraft
            })
            .catch(function(err){

            })
        },
        postRecord(id){
            // 提交报告记录接口
            var _this = this;
            flyProcess_selectReportRecord({
                id: id
            }).then(function(res){
                _this.ReportRecordInfo = res.data.reportRecords
            })
            .catch(function(err){

            })
        },
        postState(id){
            // 状态记录接口
            var _this = this;
            flyProcess_selectStateList({
                id: id
            }).then(function(res){
                _this.StateRecordsInfo = res.data.stateRecords
            })
        },
        addRecord() {
            //新增报告记录打开弹窗
            this.recordOpacitys = !this.recordOpacitys
            if(this.recordOpacitys){
                this.addRecodeForm = {
                    reportPoint : "",
                    reportPerson : "",
                    reportTime : "",
                    recordTime : "",
                    recordPerson : "",
                    describes : "",
                }
                this.saveReportType = 0;
            }
        },
        saveRecord(){
            // 新建记录报告提交保存
            var _this = this;
            if(this.recordOpacitys){
               if(_this.saveReportType == 0){
                    //新建
                    flyProcess_insertReportRecord({
                        "reportRecord": {
                            reportPoint: _this.addRecodeForm.reportPoint,
                            reportPerson: _this.addRecodeForm.reportPerson,
                            reportTime: _this.addRecodeForm.reportTime,
                            recordTime: _this.addRecodeForm.recordTime,
                            recordPerson: _this.addRecodeForm.recordPerson,
                            describes: _this.addRecodeForm.describes,
                            processId:_this.code
                        }
                    }).then(function(res){
                        _this.recordOpacitys = false
                        _this.postRecord(_this.code)
                    }).catch(function(err){})
               }else if(_this.saveReportType == 1){
                    //  修改
                    flyProcess_updateReportRecord({
                        "reportRecord": {
                            id: _this.addRecodeForm.id,
                            reportPoint: _this.addRecodeForm.reportPoint,
                            reportPerson: _this.addRecodeForm.reportPerson,
                            reportTime: _this.addRecodeForm.reportTime,
                            recordTime: _this.addRecodeForm.recordTime,
                            recordPerson: _this.addRecodeForm.recordPerson,
                            describes: _this.addRecodeForm.describes,
                            processId:_this.code
                        }
                    }).then(function(res){
                            _this.recordOpacitys = false
                        _this.showReportDocuments = true;
                        _this.showStateRecords = false;
                        _this.postRecord(_this.code)
                    }).catch(function(err){})
               }
            }
        },
        editReport(item){
            // 飞行进程 - 飞行详情进程 - 报告记录 - 修改
            this.recordOpacitys = !this.recordOpacitys
            if(this.recordOpacitys){
                
                this.addRecodeForm = {
                    id : item.id,
                    reportPoint : item.reportPoint,
                    reportPerson : item.reportPerson,
                    reportTime : item.reportTime,
                    recordTime : item.recordTime,
                    recordPerson : item.recordPerson,
                    describes : item.describes,
                }
                this.saveReportType = 1;
            }
        },
        delReport(item){
            // 飞行进程 - 飞行详情进程 - 报告记录 - 删除
            var _this =this;
            flyProcess_deleteReportRecord({
                "reportRecord": {
                    id : item.id,
                }
            }).then(function(res){
                // _this.recordOpacitys = false
                _this.postRecord(_this.code)
            }).catch(function(err){})
        },
        changeNextState(row){
            // 改变飞行进程下一个状态
            var _this =this;
            _this.code = row.id;
            var a = _this.processStateArr.indexOf(row.processState)
            
            if(a > -1){
                a += 1;
                var processState = _this.processStateArr[a];
                // console.log(row.id)
                // console.log(processState)
                if(a <= _this.processStateArr.length - 2){
                    _this.postFlyState(row.id,processState)
                    
                }else{
                    _this.$alert('飞行进程已结束，不能再修改', '提示', {
                        confirmButtonText: '确定',
                        callback: action => {
                            
                        }
                    });
                }
            }
        },
        changeMoreState(command,row){
            this.code = row.id;
            this.postFlyState(row.id,command)
        },
        postFlyState: function(id,state){
            var _this = this;
            flyProcess_update({
                "id": id,
                "processState": state
            }).then(function(res){
                if(res.status == 200){
                    
                    _this.showStateRecords = true;
                    _this.showReportDocuments = false;
                    _this.postState(id)
                    _this.getProcesslist();
                }
            }).catch(function(err){
                console.log(err);    
            })
        },
        saveStateRecord() {
            // 飞行进程 - 飞行详情进程 - 状态记录 - 保存
            var _this =this;
            flyProcess_update({
                "actualLandingGear": _this.flyProcessInfo.actualLandingGear,
                "actualLandingTime": _this.flyProcessInfo.actualLandingTimeStr,
                "actualTakeoffTime": _this.flyProcessInfo.actualTakeoffTimeStr,
                "aircraftNumber": _this.flyProcessInfo.aircraftNumber,
                "id": _this.flyProcessInfo.id,
                "processState": _this.flyProcessInfo.processState,
                "stateRecord": {
                    "currentState": _this.StateRecord.currentState,
                    "ffsId": _this.flyProcessInfo.flyPlanCode,
                    "previousState": _this.flyProcessInfo.processState,
                    "processId": _this.flyProcessInfo.id,
                    "stateTime": _this.nowTimegang,
                    "updateUser": _this.userInfo.userRightInfo.userName
                }
            }).then(function(res){
                console.log(res);
                // _this.showStateRecords = true;
                // _this.showReportDocuments = false;
                _this.flightOpacitys = false;
                _this.postState(_this.code)
            }).catch(function(err){
                console.log(err);    
            })
        },
        handleClick(tab, event) {
            //导航工具标题切换
            console.log(tab.name)
        },
        clickToolNav2(){
            //右边工具--消息打开按钮
            var _this = this;
            _this.toolNav2 = !_this.toolNav2;
            _this.toolNav1 = _this.showBookmarks = _this.toolNav3 = _this.myAtOpacitys = _this.myAttentionOpacitys = false;
        }, 
        clickToolNav1(){
            //右边工具--气象打开按钮
            var _this = this;
            _this.toolNav1 = !_this.toolNav1
            _this.toolNav2 = _this.showBookmarks = _this.toolNav3 = _this.myAtOpacitys = _this.myAttentionOpacitys =false;
        },
        clickToolNav3(){
            //右边工具--情报打开按钮
            var _this = this;
            _this.toolNav3 = !_this.toolNav3;
            _this.toolNav1 = _this.showBookmarks = _this.toolNav2 = _this.myAtOpacitys = _this.myAttentionOpacitys = false;
        },
        postMessages(){
            //获取消息信息接口
            var _this = this;
            systemMessage_selectAll({
                "messageType": ""
            }).then(function(res){
                // console.log(res);
                _this.messageNum = res.data.systemMessage.length + 2;//系统总消息
                // for(var i =0;i<_this.messageNum;i++){
                //     _this.messageArr.push(res.data.systemMessage[i]);
                // }
                
                
                _this.getEquipmentMessage();
                _this.getSystemMessage();
                _this.getIntelligenceSources();
            }).catch(function(err){
                console.log(err);    
            })
        },
        showLeftNav() {
            // 左侧导航栏显示/隐藏按钮
            this.ishideleftNav ? this.ishideleftNav = false : this.ishideleftNav = true;
            this.infosOpacitys = false;
            this.isshowBg3 = false; //从右展出第三级弹窗
        },
        showLeftNav2() {
            if (this.isshowBg3) {
                this.showLeftNav()
            }
        },
        //by fuxin 9-27 s
		prevjkmbSecondPage: function() {
            // 监控目标 - 二级菜单弹出框 - 上一页
			if(this.jkmbSecondlist.curPage > 1) {
				this.jkmbSecondlist.curPage--;
				this.getjkmbSecondlist()
			}
		},
		nextjkmbSecondPage: function() {
            // 监控目标 - 二级菜单弹出框 - 下一页
			if(this.jkmbSecondlist.curPage < this.jkmbSecondlist.totalPage) {
				this.jkmbSecondlist.curPage++;
				this.getjkmbSecondlist()
			}
		},
        getAirplaneInfo(row, event, column) {
            // 点击飞机弹出监控目标的飞机信息
            
            var self = this;
            
            self.isshowBg3 = !self.isshowBg3; //从左展出第三级弹窗
            self.ishideleftNav = true;
            self.curtargetAddress = row.targetAddress;
            self.getQuxianmap();
            map_aircraftDetail({  
                signalSource: self.cursignalSource,
                targetAddress: self.curtargetAddress,
                currentPage:0,
                pageSize:0
                
            }).then(function (response) {
                if (response.data.success) {
                	
                    self.aircraftInfo = response.data.aircraftInfo;
                } else {
                    _this.aircraftInfo = {};
                	self.$message.error('未获取到相关信息！');
                }
                _this.selectLoad(_this.curtargetAddress);
            }).catch(function (error) {
                console.log(error);
            });
        },
        getSignalNum: function() {
            // 监控目标数据总个数
            var self = this;
            map_signalSourceSumCount({}).then(function(response) {
                    
					if(response.status == 200) {
						self.SignalNum = response.data.count;
					}
				})
				.catch(function(error) {
					console.log(error);
				});
                var clock_getSignallist = setInterval(function() {
                    self.getSignallist();
                }, 5000);
			this.clock_getSignallist = clock_getSignallist;
        },
        getProcessNum: function() {
            // 飞行进程数据总个数
            var self = this;
            flyProcess_selectCount({
                istoday:"1"
            }).then(function(response) {
                    
					if(response.status == 200) {
						self.ProcessNum = response.data.flyProcessCount;
					}
				})
				.catch(function(error) {
					console.log(error);
				});
			var clock_getProcessNum = setInterval(function() {
                flyProcess_selectCount({
                    istoday:"1"
                }).then(function(response) {
                        
						if(response.status == 200) {
							self.ProcessNum = response.data.flyProcessCount;
							self.getProcesslist();
						}
					})
					.catch(function(error) {
						console.log(error);
					});
			}, 5000);
			this.clock_getProcessNum = clock_getProcessNum;
        },
        getAlarmNum: function(){
            //告警记录总数
            var self = this;
            self.getAlarmlist();
            var clock_getAlarmNum = setInterval(self.getAlarmlist,5000)
            this.clock_getAlarmNum = clock_getAlarmNum;
        },
        openMessage(row){
            // 飞行进程 - 移交按钮功能
            var _this = this;
            var ddd = {
                "t": {
                    "firstFss": row.initServerStation,
                    "id": row.id,
                    "lastFss": row.currentServerStation,
                    "lat": "29.618493015610223",
                    "log": "106.6510945558548",
                    "proccessId": row.flyPlanCode,
                    "transferPeople": row.contacts,
                    "transferTime": ""
                }
            }
            console.log(ddd)
            // console.log(row);
            _this.$confirm('此操作将移交飞行进程记录, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
                center: true
            }).then(() => {
                
                row.isBgOpacity = !row.isBgOpacity;
                var isProcessOpacity = 0;
                if(row.isBgOpacity){
                    isProcessOpacity = 1;
                }
                flyProcess_updateIsProcessOpacity({
                    "flyProcess":{
                        "id":row.id,
                        "isProcessOpacity":isProcessOpacity
                    }
                }).then(function(res) {
                    //保存移交记录
                    transferRecord_insert({
                        "t": {
                            "firstFss": row.initServerStation,
                            "id": row.id,
                            "lastFss": row.currentServerStation,
                            "lat": "29.618493015610223",
                            "log": "106.6510945558548",
                            "proccessId": row.flyPlanCode,
                            "transferPeople": row.contacts,
                            "transferTime": ""
                        }
                    }).then(function(res) {
                        console.log(res);
                    })
                })
            }).catch(() => {
           
            })
        },
        getQuxianmap: function() {
            var self = this;
            map_selectMaxMinute({
				targetAddress: self.curtargetAddress
			}).then(function(response) {
                console.log(response);
				if(response.status == 200) {
					var heightData = response.data.cat021Beans;
					var dom = document.getElementById("container");
					var myChart = echarts.init(dom);
					var app = {};
					option = null;
                    
					var haibaHeight = [];
                    var flyHeight = [];
                    if(heightData == null || heightData.length == 0){

                    }else if(heightData.length > 0) {
						for(var i = 0; i < heightData.length; i++) {
							haibaHeight.push(parseInt(parseInt(heightData[i].height) * 0.3048));
							flyHeight.push(parseInt(parseInt(heightData[i].flyHeight) * 0.3048));
						}
					}

					option = {
						xAxis: {
							type: 'category',
							boundaryGap: false,
							data: ['00:00', '01:15', '02:30', '03:45', '05:00', '06:15', '07:30', '08:45', '10:00', '11:15', '12:30', '13:45', '15:00', '16:15', '17:30', '18:45', '20:00', '21:15', '22:30', '23:45']
						},
						yAxis: {
							type: 'value',
							boundaryGap: [0, '100%']
						},
						dataZoom: [{
							type: 'inside',
							start: 0,
							end: 10
						}, {
							start: 0,
							end: 10,
							handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
							handleSize: '80%',
							handleStyle: {
								color: '#fff',
								shadowBlur: 3,
								shadowColor: 'rgba(0, 0, 0, 0.6)',
								shadowOffsetX: 2,
								shadowOffsetY: 2
							}
						}],
						grid: {
							left: 50,
							right: 20,
						},
						series: [{
							name: '模拟数据',
							type: 'line',
							smooth: true,
							symbol: 'none',
							sampling: 'average',
							itemStyle: {
								color: '#7cc2c7'
							},
							areaStyle: {
								color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
									offset: 0,
									color: 'rgba(124, 194, 199, 0.7)'
								}, {
									offset: 1,
									color: 'rgba(113, 208, 0, 0.1)'
								}])
							},
							data: haibaHeight
						}, {
							name: '模拟数据2',
							type: 'line',
							smooth: true,
							symbol: 'none',
							sampling: 'average',
							itemStyle: {
								color: '#699fd0'
							},
							data: flyHeight
						}]
					};
					if(option && typeof option === "object") {
						myChart.setOption(option, true);
					}
				}
			}).catch(function(error) {
				console.log(error);
			});
        },
        getSystemMessage:function(){
            //消息 --  系统消息
            var _this = this;
            systemMessage_selectAll({
                "messageType": "0"
            }).then(function(res){
                _this.systemMessage = res.data.systemMessage;//系统消息
            }).catch(function(err){
                console.log(err);    
            })
        },
        getEquipmentMessage:function(){
            //消息 --  设备消息
            var _this = this;
            systemMessage_selectAll({
                "messageType": "1"
            }).then(function(res){
                _this.equipmentMessage = res.data.systemMessage;//设备消息
                // console.log(_this.equipmentMessage)
            }).catch(function(err){
                console.log(err);    
            })
        },
        getIntelligenceSources:function(){
            //消息 -- 航行动态
            var _this = this;
            var RGYXTQarr = [],KYQBarr=[],
            lat,log;
            if(_this.isIntelligenceSources !=null){
                clearTimeout(_this.isIntelligenceSources)
            }
            if(_this.IntelligenceSources.length > 0){
                _this.IntelligenceSources = [];
            }
            //192.168.1.200
            axios.get("http://123.206.185.152:8090/iserver/services/avicComponent/restjsr/input/layer/RGYXTQ.json").then(function(res){
                // console.log(res.data);
                for(var i = 0 ;i<res.data[0].geometry.points.length;i++){
                    lat = res.data[0].geometry.points[i].x;
                    log = res.data[0].geometry.points[i].y;
                    RGYXTQarr.push([lat,log]);
                }
                // _this.messageArr.push(res.data)
                let geojson = {
                    "type": "FeatureCollection",
                    "features": [
                        {
                            "type": "Feature",
                            "geometry": {
                                "type": "Polygon",
                                "coordinates": [RGYXTQarr]
                            }
                        }
                    ]
                }
                let datajson = {
                    "ID":res.data[0].ID,
                    "fieldValues":res.data[0].fieldValues,
                    "geometry":res.data[0].geometry,
                    "geojson":geojson
                }
                _this.IntelligenceSources.push(datajson);
                axios.get("http://123.206.185.152:8090/iserver/services/avicComponent/restjsr/input/layer/KYQB.json").then(function(res){
                    for(var i = 0 ;i<res.data[0].geometry.points.length;i++){
                        lat = res.data[0].geometry.points[i].x;
                        log = res.data[0].geometry.points[i].y;
                        KYQBarr.push([lat,log]);
                    }
                    // _this.messageArr.push(res.data);
                    
                    let geojson = {
                        "type": "FeatureCollection",
                        "features": [
                            {
                                "type": "Feature",
                                "geometry": {
                                    "type": "Polygon",
                                    "coordinates": [KYQBarr]
                                }
                            }
                        ]
                    }
                    let datajson = {
                        "ID":res.data[0].ID,
                        "fieldValues":res.data[0].fieldValues,
                        "geometry":res.data[0].geometry,
                        "geojson":geojson
                    }
                    _this.IntelligenceSources.push(datajson);
                    
                    _this.isIntelligenceSources = setTimeout(function(){
                        _this.getIntelligenceSources();
                    },10000)
                    
                })
            });
            
        },
        Readers(val){
            console.log(val)
        },
        setIScenter(row){
            //消息-- 情报消息  -- 定位功能
            
            this.map.setView([row.geometry.center.y, row.geometry.center.x], 6)
        },

        setISgeoJson(row){
            var _this = this;
            //消息 -- 情报消息 --绘制
            
            if(_this.ISgeoJsonLayer != null){
                        
                _this.ISgeoJsonLayer.clearLayers();
                _this.ISgeoJsonLayer = null
            }
           
            var myStyle = {
                "color": "#062e4d",
                "weight": 3,
                "opacity": 0.65
            }; 
            _this.ISgeoJsonLayer = L.geoJSON(row.geojson, {
                style: myStyle,
                pointToLayer:function(geoJsonPoint, latlng){
                    return L.marker(latlng,{
                        icon: new L.icon({
                            iconUrl: 'images/map_postion.png',
                            iconSize:[19,19]
                        })
                    });
                }
            });
            
            _this.map.addLayer(_this.ISgeoJsonLayer);
        },
        showTimes(row){
            row.isTime = !row.isTime;
        },
        setPositioning(){
            var _this = this;
            //右边工具栏 - 定位
            _this.map.setView(JSON.parse(_this.userInfo.pointsDecimal.replace(/""/ig,"")), 8);
        },
        timeLines(row){
            var yjontime,yjuptime,sjontime,sjuptime,sid;
            var _this = this;

            
            yjontime = row.estimatedTakeoffTime;
            yjuptime = row.estimatedLandingTime;
            sjontime = row.actualTakeoffTime;
            sjuptime = row.actualLandingTime;
            sid = row.aircraftNumber;

            row.yjontime = _this.timeHM(row.estimatedTakeoffTime);
            row.yjuptime = _this.timeHM(row.estimatedLandingTime);

            if(sjontime != "" && sjontime != null){
                row.sjontime = _this.timeHM(row.actualTakeoffTime);
                
                if(sjontime < yjontime ){
                    row.pointQF = 1;
                    if(sjuptime =="" || sjuptime ==null){
                        // console.log('起飞：实际<预计;降落：实际无'+sid);
                       
                        row.pointJL = 0;
                        
                        row.sjuptime = "";

                    }else{
                        row.sjuptime = _this.timeHM(row.actualLandingTime);
                        //实际起飞时间 < 预计起飞时间
                        if(sjuptime < yjuptime){
                            //实际降落时间 < 预计降落时间
                            // console.log('起飞：实际<预计;降落：实际<预计'+sid);
                            row.pointJL = 1;
                        }else if(sjuptime > yjuptime){
                            // console.log('起飞：实际<预计;降落：实际>预计'+sid);
                            row.pointJL = 2;
                        }else{
                            // console.log('起飞：实际<预计;降落：实际=预计'+sid);
                            row.pointJL = 3;
                        }
                    }
                    
                }else if(sjontime > yjontime){
                    row.pointQF = 2;
                    if(sjuptime =="" && sjuptime ==null){
                        // console.log('起飞：实际>预计;降落：实际无'+sid);
                        row.pointJL = 0;
                        row.sjuptime = "";
                    }else{
                        row.sjuptime = _this.timeHM(row.actualLandingTime);
                        if(sjuptime < yjuptime){
                            // console.log('起飞：实际>预计;降落：实际<预计'+sid);
                            row.pointJL = 1;
                        }else if(sjuptime > yjuptime){
                            // console.log('起飞：实际>预计;降落：实际>预计'+sid);
                            row.pointJL = 2;
                        }else{
                            // console.log('起飞：实际>预计;降落：实际=预计'+sid);
                            row.pointJL = 3;
                        }
                    }
                    
                }else{
                    row.pointQF = 3;
                    if(sjuptime =="" && sjuptime ==null){
                        // console.log('起飞：实际=预计;降落：实际无'+sid);
                        row.pointJL = 0;
                        row.sjuptime = "";
                    }else{
                        row.sjuptime = _this.timeHM(row.actualLandingTime);
                        if(sjuptime < yjuptime){
                            // console.log('起飞：实际=预计;降落：实际<预计'+sid);
                            row.pointJL = 1;
                        }else if(sjuptime > yjuptime){
                            // console.log('起飞：实际=预计;降落：实际>预计'+sid);
                            row.pointJL = 2;
                        }else{
                            // console.log('起飞：实际=预计;降落：实际=预计'+sid);
                            row.pointJL = 3;
                        }
                    }
                }
                // console.log(yjontime)
            }else{
                row.sjontime = "";
                row.sjuptime = "";
                row.pointQF = 0;
                row.pointJL = 0;
            }
            // console.log("实际起飞"+row.pointQF+"实际降落"+row.pointJL+"--"+sjuptime)
        },
        clickNull(){
            console.log("防止事件冒泡")
        },

        setList(nums) {
            //进程服务--- 飞行详情服务 --- 记录图层切换
            if(nums == 0){
                this.listValue ="报告记录";
                this.showReportDocuments = true;
                this.showStateRecords = false;
            }else if(nums ==1 ){
                this.listValue ="状态记录";
                this.showStateRecords = true;
                this.showReportDocuments = false;
            }else if(nums ==2){
                this.listValue ="移交记录";
                this.showReportDocuments = false;
                this.showStateRecords = false;
            }
            
        },
        formClick() {
            //进程服务--- 飞行详情进程-其它信息上拉下拉按钮
            this.showQT = !this.showQT;
            this.isClass = !this.isClass;
        },
        listClick() {
            //进程服务--- 飞行详情进程-记录上拉下拉按钮
            this.islistClass = !this.islistClass
            this.isList = !this.isList;
        },

        setRadar(val){
            //天气 --- 雷达实况
            var _this = this;
            _this.Radarvalue = val;
            if(_this.Radarvalue){
                axios.get("http://111.231.99.242/zhgy/meteo/radar",{
                    params:{
                        "stype":"dbz"
                    }
                }).then(function(res){
                   
                    var s = res.data.series;
                    var times = Object.keys(s);
                    var imageUrl = res.data.host + s[times[times.length - 1]];
                   
                    var bbox = res.data.bbox;
                    var imageBounds = [[bbox.minlat, bbox.minlon], [bbox.maxlat, bbox.maxlon]];
                    if (_this.Radarlyr != null)
                        _this.Radarlyr.removeFrom(_this.map);
                    _this.Radarlyr = L.imageOverlay(imageUrl, imageBounds).addTo(_this.map);
                   
                }).catch(function(err){
                    console.log(err);    
                })
            }else{
                if (_this.Radarlyr != null)
                        _this.Radarlyr.removeFrom(_this.map);
            }
            
        },
        setIsoline(val){
            //天气 --- 等值线
            var _this = this;
            _this.Isolinevalue = val;
            
            if(_this.Isolinevalue){
                var t = new moment().add(1, 'days').format("YYYYMMDDhhmm");
                // console.log(t);
                axios.get("http://111.231.99.242/zhgy/meteo/isoline",{
                    params:{ //请求参数
                        "date": t, 
                        "elem": "RAIN03", 
                        "pressLevel": "P0000"
                    }
                }).then(function(res){
                    console.log(res);
                    if (_this.Isolinelyr != null)
                        _this.Isolinelyr.removeFrom(_this.map);
                    _this.Isolinelyr = L.geoJSON(res.data.features,{
                        onEachFeature: function (fea, layer) {
                              // 这里使用leaflet的默认弹出框显示 fea对象的各类属性信息
                            if (fea.properties){
                                var c = fea.properties.val;
                                 layer.bindPopup("<span>" + c + "</span>");
                            }
                        },
                        style: function (fea) {
                            var ss = { "color": "transparent" }; 
                            if (fea.properties){
                                ss.color = fea.properties.color;
                            }
                            return ss;
                        },
                    }).addTo(_this.map);
                })
            }else{
                if (_this.Isolinelyr != null)
                    _this.Isolinelyr.removeFrom(_this.map);
            }
        },
        setScatter(val){
            //天气 --- 天气格点
            var _this = this;
            _this.Scattervalue = val;
            
            if(_this.Scattervalue){
                var t = new moment().add(1, 'days').format("YYYYMMDDHHmm");
                console.log(t);
                axios.get("http://111.231.99.242/zhgy/meteo/scatter",{
                    params:{ //请求参数
                        "date": t,
                        "elem": "RAIN03", 
                        "pressLevel": "P0000", 
                        "disc": 8, 
                        "startX":72, 
                        "startY":14, 
                        "endX":136, 
                        "endY":54
                    }
                }).then(function(res){
                    console.log(res);
                    var textData = [];
                    for (var i = 0 ; i < res.data.ydel ; i++) {
                        for (var j = 0 ; j < res.data.xdel ; j++) {
                            var tempst = res.data.data[i][j].toFixed(1);
                            var ppp = [res.data.slon + (res.data.precision * j), res.data.slat + (res.data.precision * i)];
                            textData.push({
                                geometry: {
                                    type: 'Point',
                                    coordinates: ppp
                                },
                                text: tempst
                            });
                        }
                    }
                    var textDataSet = new mapv.DataSet(textData);
                
                    var textOptions = {
                        draw: 'text',
                        font: '14px Arial',
                        fillStyle: 'white',
                        shadowColor: 'yellow',
                        shadowBlue: 10,
                        zIndex: 11,
                        shadowBlur: 10
                    };
                    if (_this.Scatterlyr != null) {
                        _this.Scatterlyr.removeFrom(_this.map);
                    }
                    _this.Scatterlyr = L.supermap.mapVLayer(textDataSet, textOptions).addTo(_this.map);
                })
            }else{
                if (_this.Scatterlyr != null) {
                    _this.Scatterlyr.removeFrom(_this.map);
                }
            }
        },
        setLight(val){
            //天气 --- 闪电
            var _this = this;
            _this.Lightvalue = val;
          
            if(_this.Lightvalue){
                var t = new moment().add(-30, "m");
                axios.get("http://111.231.99.242/zhgy/meteo/light/scatter",{
                    params:{ //请求参数
                        "interval": 1, 
                        "date": "201810302200"
                    }
                }).then(function(res){
                    if (res.data[0].errorCode) return;
                    if (_this.Lightlyr != null) {
                        _this.Lightlyr.removeFrom(_this.map);
                    }

                   _this.useCluster(res.data);
                })
            }else{
                if (_this.Lightlyr != null) {
                    _this.Lightlyr.removeFrom(_this.map);
                }
            }
        },
        useCluster:function(data) {
            // https://github.com/Leaflet/Leaflet.markercluster
            var _this = this;
            _this.Lightlyr = L.markerClusterGroup({
              spiderfyOnMaxZoom: false,
              showCoverageOnHover: false,
              zoomToBoundsOnClick: false,
              iconCreateFunction: function(cluster) {
                  return L.divIcon({ html: '<img src="images/shandian.png" style="width:20px;height:20px"></img>', 
                                      className: 'mycluster' });
               }	
          });
            
            data.map(function (item) {
             var latLng = [item.lon_lat[1], item.lon_lat[0]];
            //  var url = "/img/light" + item.val + ".png";
            var url = "images/shandian.png"
             _this.Lightlyr.addLayer(L.marker(latLng, {
                    icon: L.icon({iconUrl: url,iconSize: [20,20]})
                }));
         });
         _this.Lightlyr.addTo(_this.map);
        },
        setDraw(){
            //绘制
            var _this = this;
           
            if(_this.isDraw !=null){
                _this.map.removeControl(_this.drawControl);
                _this.isDraw =null;
                if(_this.editableLayers != null){
                    _this.editableLayers.remove();
                    _this.editableLayers = null;
                }
            }else{
               
                //绘制工具
                _this.editableLayers = new L.FeatureGroup().addTo(_this.map);
                var options = {
                    position: 'topright',
                    draw: {
                        polyline: true,
                        polygon: {
                            allowIntersection: false,
                            showArea: true
                        },
                        
                        marker: false,
                    },
                    edit: {
                        featureGroup:  _this.editableLayers,
                        poly: {
                            allowIntersection: false
                        },
                        remove: true
                    }
                };
                _this.drawControl = new L.Control.Draw(options);
                _this.isDraw = _this.map.addControl(_this.drawControl);
              
                
                _this.map.on(L.Draw.Event.CREATED, function (event) {
                    var layer = event.layer,
                    type = event.layerType;
                    _this.alermAreaObj = event;
                    if(type == 'polygon' || type == 'circle' || type == 'rectangle'){
                   
                        layer.on('click',function(){
                            _this.alermValue = _this.alarmName = '';
                            _this.showSetAlarmOpacity = true;
                        })
                    }
                       
                    _this.editableLayers.addLayer(layer);
                    console.log(event);
                }); 
            }
        },
        setYZAL(){
            console.log("设置告警抑制区域");
        },
        setAL(){

            var _this = this;
            
            var regionType,radius,latlng,lbobj,lgArr=[];
            if(_this.alermAreaObj.layerType == 'circle'){
                regionType = 1;
                radius = _this.alermAreaObj.layer._radius;
                latlng = (_this.alermAreaObj.layer._latlng.lat+","+_this.alermAreaObj.layer._latlng.lng).toString();
                lgArr=[];
            }else {
                regionType = 0;
                radius = '';
                // if(lgArr.length != 0){
                //     lgArr = [];
                // }
                // for(var i = 0 ; i< _this.alermAreaObj.layer._latlngs[0].length;i++){
                //     lgArr.push([_this.alermAreaObj.layer._latlngs[0][i].lat,_this.alermAreaObj.layer._latlngs[0][i].lng])
                // }
                latlng = "";
                lgArr = _this.alermAreaObj.layer._latlngs[0];
            }
           
            var dataObj = {
                "points":lgArr,
                "regionInfo": {
                    "alaremType":_this.alermValue, //0 抑制区域  1告警区域
                    "regionName":_this.alarmName,
                    "id":'',
                    "pointDecimal": latlng,
                    "radius": radius,
                    "regionType": regionType,//0 区域 1 中心点
                    "userid": _this.userInfo.userId
                }
            };
            
            regionInfo_insert(dataObj).then(function(res){
                
                _this.$message({
                    message: _this.alarmName+'区域添加成功',
                    type: 'success'
                });
                _this.showSetAlarmOpacity = false;
                if(_this.settingData.showSettingGJSZ){
                    _this.ClickGJZS();
                }
            })
           
        },
        setALclose(){
            var _this = this;
            _this.alermValue = _this.alarmName = '';

            _this.showSetAlarmOpacity = false;
        },
        ClickGJZS(){
            //告警设置
            var _this = this;
            if(_this.settingData.areaYZ.length >0){
                _this.settingData.areaYZ = [];
            }
            if(_this.settingData.areaGJ.length >0){
                _this.settingData.areaGJ = [];
            }
            if(_this.settingData.showSettingGJSZ){
                regionInfo_selectAll({
                    "regionInfo": {
                        "userid": _this.userInfo.userId
                    }
                }).then(function(res){
                    
                    if(res.data.regionInfo.length != 0){
                        for(var i = 0; i<res.data.regionInfo.length;i++){
                            if(res.data.regionInfo[i].alaremType == 0){
                                // 抑制区域
                                _this.settingData.areaYZ.push(res.data.regionInfo[i])
                            }else{
                                // 告警区域
                                _this.settingData.areaGJ.push(res.data.regionInfo[i])
                            }
                        }
                    }
                    
                })
            }
            
        },
        delArea(row){
            //删除区域
            var _this = this;
            regionInfo_delete({
                "regionInfo": {
                    "id":row.id,
                    "userid": row.userid
                }
            }).then(function(res){
                console.log(res);
                _this.$message({
                    message: row.regionName+'区域删除成功',
                    type: 'success'
                });
                if(_this.settingData.showSettingGJSZ){
                    _this.ClickGJZS();
                }
            })
        },
        setBookmarks(){
            //书签
            // console.log(this.getCenterPoint());
            this.bookmarksName = '';
            this.bookmarksOpacitys = !this.bookmarksOpacitys;
        },
        closeBook(){
            //关闭新增书签（右上角叉）
            if(this.bookmarksOpacitys){
                this.bookmarksOpacitys = false;
            }
        },
        canceBookBtn(){
            //关闭新增书签（取消按钮）
            if(this.bookmarksOpacitys){
                this.bookmarksOpacitys = false;
            }
        },
        saveBookBtn(){
            //保存新增书签 经纬度和备注名
            var _this = this;
            var ajson = {
                "bookMark": {
                    "bookmarkName": _this.bookmarksName,
                    "bookmarkState": "0",
                    "id": "",
                    "lat": _this.getCenterPoint().lat,
                    "log": _this.getCenterPoint().lng,
                    "userid": _this.userInfo.userId
                }
            };
            if(_this.bookmarksName == ''){
               
                _this.$message({
                    message: '书签视角名称不能为空',
                    type: 'warning'
                });
            }else{
                bookMark_insert(ajson).then(function(res){
                    _this.$message({
                        message: '书签添加成功',
                        type: 'success'
                    });
                    _this.bookmarksOpacitys = false;
                    _this.bookMarkSelectAll();
                    console.log(res)
                }).catch(function(err){
                    console.log(err);    
                })
            }
            
            // console.log(ajson)
        },
        checkBookmarks(){
            // 右边工具---书签
            var _this = this;
            _this.showBookmarks = !_this.showBookmarks;
            
            if(_this.showBookmarks){
                _this.bookMarkSelectAll();
                _this.toolNav1 = _this.toolNav2 = _this.toolNav3 = _this.myAtOpacitys = _this.myAttentionOpacitys = false;
            }
        },
        bookMarkSelectAll(){
            var _this = this;
            var ajson = {
                "bookMark": {
                    "bookmarkName": "",
                    "bookmarkState": "",
                    "id": "",
                    "lat": "",
                    "log": "",
                    "userid": _this.userInfo.userId
                }
            };
            bookMark_selectAll(ajson).then(function(res){
                if(res.data.bookMarks.length > 0){
                    for(var i=0;i<res.data.bookMarks.length;i++){
                        if(res.data.bookMarks[i].bookmarkState == 0){
                            res.data.bookMarks[i].bookStyle = false;
                        }else if(res.data.bookMarks[i].bookmarkState == 1){
                            res.data.bookMarks[i].bookStyle = true;
                        }
                    }
                    
                    _this.bookmarksData = res.data.bookMarks;
                }
                
            }).catch(function(err){
                console.log(err);    
            })
        },
        setBookInitial(e,val){
            //头部书签 - switch 按钮设置初始值
            var _this = this,
            bookStyle = 0;
            
            if(e){
                bookStyle = 1;
            }
            // this.checkBookmarks();
            var ajson = {
                "bookMark": {
                    "bookmarkName": "",
                    "bookmarkState": bookStyle,
                    "id": val.id,
                    "lat": "",
                    "log": "",
                    "userid": _this.userInfo.userId
                }
            };
            bookMark_update(ajson).then(function(res){
                _this.$message({
                    message: val.bookmarkName+'设置成功',
                    type: 'success'
                });
                _this.bookMarkSelectAll();
            }).catch(function(err){
                console.log(err);    
            })
        },
        setAttention(){
            // 关注按钮
            getAttention(this,1);
        },
        setAtt(val){
            // 关注 --  我的关注二级菜单 -- 选择信号源
            var _this = this;
            _this.AttSingle = val.signal_source;
            // 我的关注列表点击事件
            
            _this.myAttentionOpacitys = !_this.myAttentionOpacitys;
            _this.wdgzSecondlist.curPage = 1;
            if(_this.myAttentionOpacitys){
                getSecAttention(_this,1);
            }
        },
        closeAtt(val){ 
            // 关注 --- 根据信号源选择关注飞机 ---  取消关注
            var _this = this;
            _this.AttSingle = val.signalSource;
            delSecAttention(_this,val.smodel);
        },
        getSeaverAtt(){
            // 关注 --  根据信号源选择关注飞机  --- 搜索
            var _this = this;
            getSecAttention(_this,1);
        },
        
        prevwdgzSecondPage: function() {
            // 关注 - 根据信号源选择关注飞机 - 上一页
            if(this.wdgzSecondlist.curPage > 1) {
                this.wdgzSecondlist.curPage--;
                getSecAttention(this,1);
            }
        },
        nextwdgzSecondPage: function() {
            // 关注 - 根据信号源选择关注飞机 - 下一页
            if(this.wdgzSecondlist.curPage < this.wdgzSecondlist.totalPage) {
                this.wdgzSecondlist.curPage++;
                getSecAttention(this,1);
            }
        },
        initGeojsonZJ1(){
            var geoJSON = {
                "type": "FeatureCollection",
                "features": [
                    {
                        "type": "Feature",
                        "properties": null,
                        "geometrys": null,
                        "geometrysNew": {
                            "type": "Polygon",
                            "coordinates": [[[120.04916666666666,30.377777777777776],[120.175,30.4975],[120.17083333333333,30.551388888888887],[120.05305555555556,30.488055555555555]]]
                        }
                    }
                ]
            }
            var _this = this;
            // console.log(geoJSON);
            if(_this.userGeoLayer1 != null){
                        
                _this.userGeoLayer1.clearLayers();
                _this.userGeoLayer1 = null
            }
            var strA = JSON.stringify(geoJSON);
        
            var strB = strA.replace(/geometrysNew/, "geometry");
            var strC = strB.replace(/geometrys/ig,"geometry");
        
            var jsonD = JSON.parse(strC);
        
        
            var myStyle = {
                "color": "#062e4d",
                "weight": 3,
                "opacity": 0.65
            }; 
            _this.userGeoLayer1 = L.geoJSON(jsonD, {
                style: myStyle,
                pointToLayer:function(geoJsonPoint, latlng){
                    return L.marker(latlng,{
                        icon: new L.icon({
                            iconUrl: 'images/map_postion.png',
                            iconSize:[19,19]
                        })
                    });
                }
            });
            // this.map.setView(e.target.getLatLng(), 10);
            _this.map.addLayer(_this.userGeoLayer1);
        },
        initGeojsonZJ2(){
            var geoJSON = {
                "type": "FeatureCollection",
                "features": [
                    {
                        "type": "Feature",
                        "properties": null,
                        "geometrys": null,
                        "geometrysNew": {
                            "type": "Polygon",
                            "coordinates": [[[119.91805555555555,30.629722222222224],[120.27888888888889,30.656111111111112],[120.29333333333334,30.505555555555556],[119.99277777777777,30.483888888888888]]]
                        }
                    }
                ]
            }
            var _this = this;
            // console.log(geoJSON);
            if(_this.userGeoLayer2 != null){
                        
                _this.userGeoLayer2.clearLayers();
                _this.userGeoLayer2 = null
            }
            var strA = JSON.stringify(geoJSON);
        
            var strB = strA.replace(/geometrysNew/, "geometry");
            var strC = strB.replace(/geometrys/ig,"geometry");
        
            var jsonD = JSON.parse(strC);
        
        
            var myStyle = {
                "color": "#062e4d",
                "weight": 3,
                "opacity": 0.65
            }; 
            _this.userGeoLayer2 = L.geoJSON(jsonD, {
                style: myStyle,
                pointToLayer:function(geoJsonPoint, latlng){
                    return L.marker(latlng,{
                        icon: new L.icon({
                            iconUrl: 'images/map_postion.png',
                            iconSize:[19,19]
                        })
                    });
                }
            });
            // this.map.setView(e.target.getLatLng(), 10);
            _this.map.addLayer(_this.userGeoLayer2);
        },initGeojsonZJ3(){
            var geoJSON = {
                "type": "FeatureCollection",
                "features": [
                    
                    {
                        "type": "Feature",
                        "properties": null,
                        "geometrys": null,
                        "geometrysNew": {
                            "type": "Polygon",
                            "coordinates": [[[119.82,30.6225],[119.91805555555555,30.629722222222224],[119.99277777777777,30.483888888888888],[119.835,30.471944444444443]]]
                        }
                    }
                ]
            }
            var _this = this;
            // console.log(geoJSON);
            if(_this.userGeoLayer3 != null){
                        
                _this.userGeoLayer3.clearLayers();
                _this.userGeoLayer3 = null
            }
            var strA = JSON.stringify(geoJSON);
        
            var strB = strA.replace(/geometrysNew/, "geometry");
            var strC = strB.replace(/geometrys/ig,"geometry");
        
            var jsonD = JSON.parse(strC);
        
        
            var myStyle = {
                "color": "#062e4d",
                "weight": 3,
                "opacity": 0.65
            }; 
            _this.userGeoLayer3 = L.geoJSON(jsonD, {
                style: myStyle,
                pointToLayer:function(geoJsonPoint, latlng){
                    return L.marker(latlng,{
                        icon: new L.icon({
                            iconUrl: 'images/map_postion.png',
                            iconSize:[19,19]
                        })
                    });
                }
            });
            // this.map.setView(e.target.getLatLng(), 10);
            _this.map.addLayer(_this.userGeoLayer3);
        }
    },
    directives:{
        drag(el,bindings){
            // （飞行进程详情弹出框） 拖动界面功能
            el.onmousedown = function(e){
                var disx = e.clientX - el.offsetLeft;
                var disy = e.clientY - el.offsetTop;
                document.onmousemove = function (e){
                    el.style.left = e.clientX - disx+'px';
                    el.style.top = e.clientY - disy+'px';
                }
                document.onmouseup = function(){
                    document.onmousemove = document.onmouseup = null;
                }
            }
        },
    }
});